#How to await an AnimatedSprite2D animation?

3 messages · Page 1 of 1 (latest)

junior thicket
#

I'm trying to have a node await an animatedsprite2D animation before queue-freeing but it doesn't seem to work, the queue_free isn't being run but everything else is. It is worth mentioning I'm using a parent script called Entity to call an @export variable AnimatedSprite2D's animation.

  • Here’s my code:
func damage(amount : int):
    health -= amount
    if health <= 0:
        health = 0
        animated_sprite.play("Death")
        await animated_sprite.animation_finished
        queue_free()
last yoke
#

Could you show the code for that Entity script?

flat cradle
#

is the animation looping?