Jump to content
  • Advertisement
Sign in to follow this  
flashinpan

spritesheet woes

This topic is 2518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am struggling with making my sprite sheets work correctly.

It seems like every time I make a small change, like adding a few more cells to an animation sequence - I start to get some "drift" in the animation. Instead of the animation staying in one place it kind of moves while it is animating. I hope somebody knows what I am talking about. Sometimes playing with the width of the destination rectangle seems to adjust it and fix it, but not this time.

Are there tools that can help me create and maintain stable dependable spritesheets?

Share this post


Link to post
Share on other sites
Advertisement
I looked at your other topic about animated sprites, and I couldn't help noticing that you're hard-coding a lot of stuff like frame width and height and dividing the total texture width by frame width in order to extract your frames.
I'm absolutely positive you've got some sort of off-by-one problem, but I would suggest a different approach.

Instead of hard-coding everything, why not outline your sprites on the sprite sheet in a certain color, and use that outline to detect and load each frame of your animation? It could even be used to have a variable width and height per frame. This is what I do right now, and it works great.

Here's what an algorithm might look like:
  • load texture from file
  • for each pixel in texture:
    • if the pixels above, to the left, and the upper left of this pixel are our "magic color"
      • then this is a frame of animation. Detect the edges and extract it into its own texture.

Share this post


Link to post
Share on other sites
I've read your most recent post, and I will try to implement your suggestions as soon as I can.

Just need to find some quiet time...which is sometimes in rare quantities....

Share this post


Link to post
Share on other sites
Hello,

There are tools to generate sprite sheets automatically. I suggest you to use Sprite Master. It generates sprite sheets with your sprite images automatically and generates your sprite sheets possible smallest size with advanced algorithms (like MaxRects). It also generates output for coordinate data of your each sprite in the sheet.

You can take a look at YouTube video here.

Here is a screen shot of it:Sprite_Master_Features.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!