6. Animation

Now the fun begins in earnest as we take a look at animating our sprites. Although some games don’t use animations, almost any game can be enhanced by introducing animated figures.

Requirements for Animation

When we talk about animation in games, we’re talking about sprites that change form as they move during the game’s action. In the context of AndEngine, animations are distinct from simple translation and rotation of objects, where the form of the object doesn’t change, even though it’s moving. Rotation and translation were covered in the discussion of Modifiers in Chapter 4.

To animate an object, we need to display frames that represent the object’s form—one frame at a time, with each frame shown for a set time. Our eyes and ...

Get Learning Android Game Programming: A Hands-On Guide to Building Your First Android Game 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.