The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I want to make a few animations behind other animations when they finished but with out a Timer. What is wrong ( if animation_finished("name"): print("test")) ?

Godot version 3.2.2
in Engine by (254 points)

Did you properly set up the signal connections for the animations? Do any of the animations loop?

Hey there!
This is just not how signals work in Godot, you have to connect them to a script through the "Node" tab that is right next to the Inspector. When you do so, a new function will be created on your script. It should look something like:

_on_AnimationPlayer_animation_finished(anim_name):

I'm not sure if this is how the name looks like by default... Anyways, this function (that may have any name you wish as long as you connect it from the Node tab) will be called every time an animation finishes.

So, taking your code as an example... It should look like this, if correctly used the function.

_on_cool_animation_thing_finished(anim_name):
    if anim_name == "name":
        print("test")

Hope I helped you!
Basicly the function is automatically called once the even triggers.

If you want to learn more about signals, check this page on the docs.

Ok, thanks it works.

1 Answer

+1 vote
Best answer

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)

  • This causes a bunch of interested_object.function_to_call(animation_name) to be executed.

In your case, you want to make a function, say _on_finished(name: String),
and connect it to your AnimationPlayers animation_finished, inside a _ready().
func _ready():
. anim.connect("animation_finished", self, "_on_finished")
func _on_finished(name: String):
. print("Finished ", name)

by (2,720 points)
selected by
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.