#Animation doesn't disappear after a queue_free()

1 messages · Page 1 of 1 (latest)

graceful cedar
#

Hello! good day. First of all, I want to clarify that I am following "HeartBeast" tutorials on how to make an RPG game, and the tutorial I saw was for the animation for when you defeat an enemy.

I finished the entire tutorial and followed it step by step, but when I defeat the enemy, the death animation is executed and when it finishes, it stays in the last frame and is not removed from the screen.

I attach images of the code and animation. Thank You!

left moth
#

Try adding a script to EnemyDeathEffect, goto its node signals, connect up animation_finished and tell it to despawn. That should make the death animation disappear after it plays once.

func _on_animation_finished() -> void:
    queue_free()
floral wave
#

It's the animation that's staying put, not the enemy. Currently you're only deleting the enemy. When you instantiated a new death effect, it's basically making a brand new object. You need to make sure the object cleans up after itself.

The on_animation_finished signal like injate suggested is probably best suited for this.

graceful cedar
#

Thank you very much! 🫶