When animating for the Android platform is it a better practice to create a sprite sheet with multiple states for each sprite on a single picture or should I instead export individual images for each character/state/etc.? Which option gives me a smaller file size for resources and which is easier for the programmer to animate?

up vote 4 down vote accepted

It depends how many you have and how many of those would be in use at any given time.

I would break it down as follows:

For each "sprite" I would have one sheet, each WxH section is a single frame. If there are only a few states, I'd keep those all in the same image file, and just make a map of

  1. Walking is sprites 0-9
  2. Jumping is 10-15
  3. Crouching is 15-20

If you have many states per sprite, I would consider breaking up each state animation into its own file.

If you only have a few sprites and a few states, it might be best to simply have it all on a single image file, and use the maping I have above, but include it per sprite. This will keep the amount of memory usage to a minimum, since you're targeting android, memory is a premium resource and should be conserved where possible.

One of the biggest speed advantages from using a sprite sheet is that you can render multiple instances of the sprite batched with a single draw call. If you do it with individual images then each character (or whatever) on screen is going to be a different draw call unless they happen to be on the same animation frame.

In general you probably want to atlas as much as possible onto a single sheet.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.