0 votes

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"):
    elif Input.is_action_just_pressed("RMB"):

func punch_process(_delta):
    if _animation_player.play == false:
    elif _animation_player.play("jab") == true:
    elif _animation_player.play("cross") == true:
Godot version 3.4
in Engine by (14 points)

1 Answer

0 votes

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.

by (3,326 points)

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.