+1 vote

hello everyone! I would like to know how it is that I can make that when an animatedsprite 2d animation ends, another one begins and that it makes a loop or that if I have a key pressed and an animation is playing and as soon as I stop pressing the key another animation without loop begins and as soon as it finishes, the idle animation starts

Godot version Godot_v3.4.3
in Engine by (38 points)

1 Answer

+1 vote
Best answer

In the animated sprite if you go to the signals section you will see a signal "Animation_Finished".

This signal will happen when that animated sprite finishes its animation so you can link this to a function in a script to restart a new animated sprite immediately. when you click on the signal it will prompt you to link it to a function in a script so it isnt too difficult.

You can just link it to a function which restarts a given animation or you could manually emit a signal with the animation name in if you wish, this requires a bit more setup but basically you can do it as below.

For a signal named animation_finished inside an object named anim.

Objects tell anim that they are interested to know when animation_finished happens.

anim.connect("animation_finished", interested_object, "function_to_call")

Anim eventually notifies everyone.

 emit_signal("animation_finished", animation_name)
(default nodes emit their signals automatically)
by (1,685 points)
selected by

THANKS!!!!!! It Helped Me a Lot

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.