How to check WHICH animation finished (AnimatedSprite signal)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Oian

Hi!

The animation player has a signal on_animation_finished with a parameter of the specific animation.
The AnimatedSprite node however doesn´t seem to have that, so how could i check the animation that just finished anyway?

thanks~

:bust_in_silhouette: Reply From: Error7Studios

You can emit a custom signal whenever the built-in animation_finished signal is fired.

extends AnimatedSprite

signal current_animation_finished(anim_name)

func _on_animation_finished() -> void:
	emit_signal("current_animation_finished", animation)

func _on_current_animation_finished(anim_name: String) -> void:
	print("Finished animation: ", anim_name)

func _ready():
	connect("animation_finished", self, "_on_animation_finished")
	connect("current_animation_finished", self, "_on_current_animation_finished")