If you call queue_free()
right after you start your new animation, the animation won't show because your fireball will be removed pretty much instantly. Keep in mind that while queue_free()
does not immediately delete an object, it will be deleted in the next frame, so at 60 fps it will be gone in about 16.6 milliseconds.
You could do something like
func _on_Fireball_body_entered(body):
$AnimatedSprite.play("explo")
yield($AnimatedSprite, "animation_finished")
queue_free()
This will pause the body entered function until the animation has finished (signal animation_finished
is emitted by AnimatedSprite
and then free the fireball (the code above is untested, but you get the idea :) ).
For more info on yield
, see the docs.