Rendering sprite-sheet-based animations

So far, we have seen how to render textures and regions of an atlas using Libgdx. Obviously, you can move textures around over time to produce a sense of motion. However, your characters will not come to life until they are properly animated. Not only should they go from one side of the screen to the other, but they should also seem like they are walking, running, or jumping according to their behavior.

Typically, we refer to characters physically moving in the game world as external animation, while we use the term internal animation to talk about their body movement (for example, lifting an arm).

In this recipe, we will see how to implement sprite-sheet-based animation using mechanisms provided by Libgdx. ...

Get Libgdx Cross-platform Game Development Cookbook 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.