Tile animation with standard java MapReader


Hello guys

I recently started a little game using Tiled(great job btw :+1:t2:) and Java without any frameworks.
Currently i’m using the standard tiled.io.TMXMapReader and it looks pretty well so far.
But when i try to load a map with animated tiles, just the original tiles are shown.

Now i would like to know if there is a way to realize it with the standard map reader or if it’s more recommendend to use a framework which already implemented this feature.

(Thorbjørn Lindeijer) #3

Nice to hear you’re enjoying Tiled! Unfortunately though, tile animations are currently not implemented in libtiled-java. The AnimatedTile class is an old remnant from Tiled Java and not currently functional.

If you’d like to look into supporting tile animations, you should start with the generated org.mapeditor.core.Frame and org.mapeditor.core.Animation (referenced from TileData.animation) and look into some way of driving the animation and rendering the “current frame” when rendering a tile. It may be that the code in AnimatedTile helps, but it could also be misleading.

Since I don’t personally code Java at the moment, any help in maintaining or improving libtiled-java is greatly appreciated!


Thanks for your response.
I added some methods to some of your classes to load the animated tiles into my game. But it’s too messy and too specific to share it at the moment.
I will let you guys know when i manage to create a clean and general solution.