Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | alwaysusa |
Here’s a paste of the code. The rpint statements are there to help me debug.
func explode():
print("explode called")
if $AnimatedSprite.is_playing():
print("still playing")
print($AnimatedSprite.animation)
yield(get_node("AnimatedSprite"), "animation_finished")
print("finished")
queue_free()
In the above code, “finished” is only printed if the animation is actively playing at the point it reaches the if conditional (if the current frame < final frame). In that case, the yield works as expected. It waits, then continues to the print statement and the queue_free.
If the animation has already finished (current frame = last frame) by the time it reaches the $AnimatedSprite.is_playing conditional, it still returns true (the print statements both show) but the yield doesn’t return.
So it appears as if the animation_finished signal is not being called on an animation that has already finished, even though is_playing is still considered true.
Any idea what I’m doing wrong here?