Open FlixelCommunityBot opened 11 years ago
Animated tilemaps are something that should totally be a part of flixel. It's probably a majority of tilemap-based games that needs them at some point, and having to use sprites just for a few animations is a bit annyoing.
However, this class doesn't seem compatible with the current version of flixel - the second paramter of loadMap
is not TileArray
(whatever that was needed for) anymore, but TileGraphic
.
I like that too, but I don't think changing the whole tile map every frame is the best approach. Maybe something simpler like adding a new parameter to setTileProperties()
to indicate the animation or a new method: setTileAnimation()
.
@Dovyski The code only changes the image one time when the time between each frame is passed. This is why the setDirty(true) code only happens if (dirty) For example, if the map is set to animate every 1 second it will do almost nothing other than count down a timer till the 1 second passes. Then for one frame change the image to the new tileset. I can't come up with a quicker way to so this, though I'm curious if someone can. In practice it works quite nicely.
@Gama11 Not sure about compatibility with this version, it worked fine for the version I wrote it for, if you want I can try to link it against a different version, I'm sure the changes needed would be tiny.
Oh, I see now @msilver101 . Thanks for clarifying that!
Issue by msilver101 from 2012-10-27T22:53:39Z Originally opened as https://github.com/AdamAtomic/flixel/issues/233
I've written a class that extends FlxTilemap. Its really useful if you have an animated tileset that you want to use for say a top down strategy game. Feel free to use it and change the opening comment to be licensed however you want.
I've called it 'FlxAnimatedTilemap.as' in my branch.