Why can't we use animated sprites in a tile map?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Forward

This seems like a basic feature the engine should have? Why can’t I have a flashing block or a water animated block in my tile map? Is there somewhere I can submit this as a feature request?

:bust_in_silhouette: Reply From: fpicoral

I think that the best place would be on the GitHub on the issues page (remember to post as [SUGGESTION] or something like that since the main purpose of the page is for issues.

GitHub: GitHub - godotengine/godot: Godot Engine – Multi-platform 2D and 3D game engine

:bust_in_silhouette: Reply From: kidscancode

Godot 3.1 includes AnimatedTexture for just such purposes.

“Also, it doesn’t support AtlasTexture. Each frame needs to be separate image.”

rakkarage | 2020-04-09 15:30

:bust_in_silhouette: Reply From: rakkarage

i got it working with a shader :slight_smile:

Animates an atlas in a cycle offset by frame so each instance is not, necessarily, in sync. Can select priority paint to let godot tilemap editor pick a random tile animation for you.

shader_type canvas_item;

uniform sampler2D frames: hint_albedo;
uniform float count;
uniform float duration;
uniform float width;

void fragment() {
	float frame = floor(mod(TIME, count * duration) / duration);
	float offset = floor(UV.x / width);
	COLOR = texture(frames, UV + vec2((mod(offset + frame, count) - offset) * width, 0));