How to make an animated tile frame with random duration

Godot Version

4.5.1

Question

I have a water tile with a few different frames of varying brightness. When all the tiles are animating it looks like the water is glittering. I want to know how I can attach a script to make each frame have a random duration (e.g 0.1 - 1.0 seconds)thanks

Ok so I discovered the easiest way was to make the water tile its own AnimatedSprite2D scene and attach this script:

extends AnimatedSprite2D

@export var speed: float = .1

func _ready() -> void:
	play("sparkle",speed + randf_range(0.01, 0.05))

and then add the water scene to the tileset.

Noob problem solved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.