Closed bojidar-bg closed 6 years ago
I have made some animations with AnimationPlayer changing texture region of individual tiles (or all the tileset), using frames could be more easy but depends on the tilemap, not regular tiles are allowed and using the region will be the best option.
@eon-s well, if you check that minilens example again, it was exactly what we did -- changing the region.
All cells with the same tile id would get the same frame at a given point in time; a cell added later would still get the same frame as other cells with the same tile.
May an integer phase value be added to this feature? Phase value of each tile will mean
# n: current frame number
# p: phase value
show frame[n + p] for this tile
It can be useful I think. Will it make additional performance impact?
@hubbyist if it is per-cell, it would probably require an additional byte per cell or so. Performance might be impacted if we run into CPU cache issues, but not way too much. In case we are doing this, we would probably get per-cell pausing of animation as well.
This would be incredibly useful for when importing Tiled maps as well using the existing (and future) plugin from the asset lib (I think @vnen is the author?).
This will be possible in 3.1 with the new AnimatedTexture
(coming soon).
What is the status of the issue? Is it already solved in current master?
No, I totally forgot about this. Sorry, thanks for the reminder ^^
Any idea on the release date of this? Really looking forward to it :)
With the new AnimatedTexture, can this be closed?
I think so yeah. Haven't used them, but from reduz's comments, it should work.
Going to close as it was implemented.
As reduz mentioned on twitter, the AnimatedTexture won't work for AtlasTexture. Now I wouldn't want to assume my ways to be the best practice but i am assuming that lots of people (if not most) working with the TileMap are using TextureAtlasses to manage lots of tiles.
What would now be the way to go if we consider the AnimatedTexture to solve our animated tiles issue? Should we keep every frame in a separate image file if a tile is animated or am I missing a better workflow?
you can animate the region of the atlas texture with an animation player selecting the texture of the tileset resource from the tilemap node then you add a modulate key frame so the tilemap updates, I'm not sure if this is efficient but it works.
AnimatedTexture requires you to use a different file (e.g png files) for each frame in the animation. In my case, each different type of tile has 50 frames of animation in total. So dragging and dropping 50 * 12 png files into the frames of each AnimatedTexture would be really inefficient and could easily lead to mistakes being made. I do not understand why AnimatedTexture wasn't made to work with spritesheets the way SpriteFrames does.
Part of what was mentioned in #5965, putting as separate issue for maintainability.
Why animations in tilemaps? "We already have AnimationPlayer for that!"
Yes, we do. Actually, we can already make animations with tilemaps, as evidenced by Minilens:
Unfortunately, this is very hacky, and also forces update of all quadrants, as opposed to just quadrants which have the animated tile.
Ok, so what's the idea?
(terminology note: a
TileMap
is made up of cells. Each cell is of a specific type, know as a tile.)After discussing the issue with @ArcFutahito on IRC, we agreed on the following idea:
TileSet
should be made animateable somehow (probably viaSpriteFrames
)AnimationPlayer
andAnimatedSprite
do. It might be useful to seek it as well.About the implementation, I'm still not sure if we should keep cells with animations on separate canvas items, as to save some redraws. So, this is also something we might want to discuss.