How can I make the code identify if an animation is playing?

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

so to have multiple animation, I needed multiple sprites, but for this to work I need only one sprite shown at one time and the rest hidden. This is my attempt (obviously not working). How can I make it so that the code detects if a particular animation is playing and then accordingly hide a show sprites.

func _process(_delta):
	if Input.is_action_just_pressed("LMB"):"jab")
	elif Input.is_action_just_pressed("RMB"):"cross")
func punch_process(_delta):
	if == false:
	elif"jab") == true:
	elif"cross") == true:
:bust_in_silhouette: Reply From: Gluon

There is a signal on animation players called finished. You can start a function when that signal is sent with something like this

animation.connect("finished", self, "FunctionWhenAnimationIsDone")

which will start a function once the animation has finished.

Thanks man but I figured out another way of animating which is easier.

WorkedPython | 2021-12-05 14:05