Sprite Animation
If you've ever played a 2D video game, you know that you are still missing a vital component: sprite animation. The animation consists of so-called keyframes, which produce the illusion of movement. Figure 8–25 shows a nice animated sprite by Ari Feldmann (part of his royalty-free SpriteLib).
The image is 256×64 pixels in size, and each keyframe is 64×64 pixels. To produce animation, you just draw a sprite using the first keyframe for an amount of time—say, 0.25 s—and then you switch to the next keyframe, and so on. When you reach the last frame you have ...
Get Beginning Android 4 Games Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.