spritesheet woes

Started by
2 comments, last by bateristt 12 years, 3 months ago
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?
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.
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....
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
http://www.mobinodo.com/spritemaster

http://www.twitter.com/mobinodo

This topic is closed to new replies.

Advertisement