21 lines
361 B
GDScript
21 lines
361 B
GDScript
extends AnimatedSprite2D
|
|
|
|
@export var randDelayMin:float = 0
|
|
@export var randDelayMax:float = 0
|
|
|
|
var delayLeft = 0
|
|
|
|
var rng = RandomNumberGenerator.new()
|
|
|
|
func _ready():
|
|
if randDelayMax <= 0:
|
|
play()
|
|
else:
|
|
delayLeft = rng.randf_range(randDelayMin, randDelayMax)
|
|
|
|
func _process(delta):
|
|
if delayLeft > 0:
|
|
delayLeft -= delta
|
|
if delayLeft <= 0:
|
|
play()
|