Spooky Pooky #22 - Tile Animations

Published on 07 Jun 2015 by Joe

Been a sparse few weeks for gamedev what with one thing and another, however I've been trying to get some tiny things done here and there.

Finally added tile animations. Another little feature that took a little longer than it should have.

Tiled has some support for tile animations, allowing you to specify a sequence of tiles from the set and the delays between them. So I added support for loading external tilesets (tsx) files and associated animations, plus some simple in-game code for rendering them.

My implementation was knocked up in a distracted hour or so and isn't what you might call elegant. I store a list of tile animations for the level (each specified as a collection of tile + delay structs), and a lookup table containing an entry for each tile id.

Each game loop I update the current tile for an animation (if past the delay time) and change the entry in the lookup table. Similar to how an indexed colour palette is implemented.

Like I say, not exactly elegant but fast at render time.

Published on 07 Jun 2015 by Joe
Back to index