I’m have an int variable that increases every time a button a pressed, and I have animations that are named “1”, “2”, “3”, etc, and so I basically want it to work like this:
if Input.is_action_just_pressed(“ui_accept”):
$AnimatedSprite2D.play(var_int)
so that it will play the corresponding animation to the value of the variable
extends AnimatedSprite2D
var anim = "0"
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var animationScene = anim.to_int()
if Input.is_action_just_pressed("ui_accept"):
animationScene = (animationScene + 1)
$".".play(anim)
if Input.is_action_just_pressed("ui_up"):
get_tree().quit()