Tile Animation

BlitzPlus Forums/BlitzPlus Programming/Tile Animation

thalamus(Posted 2005) [#1]
I'm writing a Map Editor and the time has come to implement animated tiles.

Maps are currently stored as DataBanks, while tiles are basically a strip of 256 32x32 tiles.

My Editor allows maps of 8 layers, with 8 different tilesets (each layer can use a different tileset).

Any suggestions as to the best way to approach the storage of animations, and the actual system for animating the tiles?


CS_TBL(Posted 2005) [#2]
perhaps an animating tile wouldn't need to be a tile, rather try that tile to be an NPC (one that doesn't interact with any player/enemy)! You won't have to make drastic changes to your map then, because NPC's are stored somewhere else.

Naturally, I dunno how many animating tiles you need in your map, but for simple moving lights on the wall, it could prove to be enough..


Nicstt(Posted 2005) [#3]
save the file as an image, either bmp or jpeg and use drawanimimage to show particular ones, use an offscreen canvas to draw if required.

I wrote a program to convert images to data, but they can easily become very large, but is an option.

Link here:
http://www.blitzbasic.com/Community/posts.php?topic=48113

There isnt code to convert back that u could copy and paste to your program, but the program can convert back so the code is there, just not all in one spot.:)


aab(Posted 2005) [#4]
Ive always done it with similarity to the way CS_TBL suggested: However I either produce an overlay sprite layer where each tile has a range of more data than the tiles in other layers, but most of them being blank in the file (by storing the distance to the next sprite tile after each sprite tile, or just storing coordinates), or allow each tile to have a value that dictates wether they have 'extra' parameters that will allow much more storage information such as additional tile animimage, frame width/height speed etc.


Kevin_(Posted 2005) [#5]
I agree. If you try to animate tiles then you are making things complicated. Keep it simple. Tiles are static things that shouldn't be animated. If you want to animate a background then set one of your layers aside for sprites only filled with mainly zeros (nothing happens). Then use a value to trigger off a sprite animation when a bit of background needs animated. It works for me.