How do i check for when my Animation (from AnimatedSprite) is finished?

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

this is what im trying to get
if attack_anim is finished: $AnimatedSprite.play("idle")
but i dont understand what to do like using is_playing or animation_finished() because im an absolute beginner, this is all i have right now:
`#func attack():

if Input.is_action_just_pressed(“ui_hit”) and is_on_floor():

is_Attacking = true

print(“hit”)

$AnimatedSprite.play(“Attack”)

:bust_in_silhouette: Reply From: chugwig

Godot uses signals to pass messages up the node tree, and AnimatedSprite has one for when the animation finishes.

https://docs.godotengine.org/en/stable/classes/class_animatedsprite.html

$AnimatedSprite.connect(animation_finished , self, "name_of_your_function")

The function called name_of_your_function will be called when the animation finishes. You can do this through the editor using the signals tab.