Tilengine - The 2D retro graphics engine forum
Tile animation (ON/OFF switch case) - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7)
+--- Thread: Tile animation (ON/OFF switch case) (/showthread.php?tid=2297)



Tile animation (ON/OFF switch case) - System64 - 08-06-2023

Hi, I have some questions about tile animations.

I am trying to make an ON/OFF switch gimmick like what you can find in Super Mario Maker 2 :


In my case, the state of the switch is stored in a Boolean variable.
The best way to achieve this effect I think is through animations. However, I can't find a way to control animations to achieve this effect.
The way I achieved the gimmick is by iterating through THE ENTIRE TILEMAP and change the index of the tiles I want to switch, so, very unoptimized.

Do you know how I can achieve that?
Thanks for your answer!


RE: Tile animation (ON/OFF switch case) - megamarc - 08-09-2023

Hi!
I'm out on holidays now, but I'll consider it after I return. Right now there's no direct way to achieve the effect you want. It would require two new calls:
1. Query a tileset to get a list of handles of its built-in animations
2. Add an enable/disable animation call