SSBMTonberry/tileson

Animated Tiles

hsdk123 opened this issue · 2 comments

Hi, I was wondering how I'd fetch info for animated tiles

ex. https://www.youtube.com/watch?v=ZNEH-rFQ7Ys

Hello, @hsdk123 , and my apologies for answering your post so late.
If you haven't figured it out already, the animation data is located inside the tson::Tile class.
It's not really showcased in the demo, even though there are animation data on one of the tiles. A quick example how I retrieve animation data from a known Tile in one of my unit tests is:

map->getTileset("demo-tileset")->getTile(36)->getAnimation()

getAnimation() will give you a vector of frames. This is what the code itself looks like:
image

And the tson::Frame class looks like this:
image

Again: Sorry for the late reply, and I hope this helped :)

I'll add this issue to the v1.3.0 release, to remind myself to include an example of animations in the demo.

Example is now updated to showcase the new tson::Animation class and how to use it. Right now this must be compiled in the master branch (which requires the BUILD_EXAMPLES flag in CMake to be activated)