Check that ending animation is not looping before resetting it (#456)

This commit is contained in:
Julian Murgia
2021-11-22 13:08:47 +01:00
committed by GitHub
parent 9a443bf30a
commit 5a94d9be73

View File

@@ -150,10 +150,10 @@ func get_length(name: String) -> float:
#
# - name: Name of the animation played
func _on_animation_finished(name: String):
if _is_animation_player:
if _is_animation_player and not _animation_player.get_animation(name).loop:
_animation_player.stop()
_animation_player.seek(0)
else:
elif not _animated_sprite.frames.get_animation_loop(name):
_animated_sprite.stop()
_animated_sprite.frame = 0
emit_signal("animation_finished", name)