Triggering an animation after a button press?

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

I would like to use animations, as a way to smoothly transition between scenes. Following Angega Studios’ Flappy Bird tutorial I am making a flappy bird clone to practice since I’m a beginner.
However I’m having trouble with the AnimationPlayer, I will post imgur links with everything I’m talking about below.
First of all I tried creating a stage manager, which would, when you change the scene, simply fade to and from black.

Imgur

However, when I try implementing it in the death stage when you press the replay button, the button just stops working, I found somewhere that it’s because of the animation’s layer, so I tweaked that as you can see in the first picture but it still doesn’t work, what’s even worse, when I remove the stage_manager call in the script the button still continues not working and idk why.
Here is the death scene script:
Imgur: The magic of the Internet

I also have a main menu scene which should also transition with an animation, but aswell I make the animation, try playing it just in the animation player toolbar and it look exactly how I want it, then I try calling it in the scene’s script on the button press and the buttons just stop working, and then when I delete it, the button still doesn’t work, even when I disconnect and connect the signal, I have to completely delete the button and do it again for it to start working. I’m sure I’m overlooking something fairly simple I just don’t know what and it’s really frustrating. If you guys need I can provide any more pics y’all need.

Is your stage manager a singleton auto-load? Because if it isn’t, change_scene() will wipe it out.

It’s also hard to tell what could be wrong since “not working” and screenshots is pretty vague. At this point you could provide your project, or try to reproduce your feature in a simpler project to make sure it works. Is the signal actually firing? Did you put prints or breakpoints in the methods you expect being called, to see if they are called?

Zylann | 2019-09-06 17:28

:bust_in_silhouette: Reply From: Annoying_Brother

Where is the animation located?
get_parent() is to get parent.
get_node(“AnimationPlayer”).play(“animation_name”)