This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

My problem is really simple, but I can't wrap my head around it. What I'm trying to do is to play an animation, and then switch scenes. Here's the code that I want to improve:

extends Control

onready var animplayer = get_node("../../AnimationPlayer")

func _input_event(ev):
    if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==BUTTON_LEFT and ev.pressed):"AnimationPlayer")

func _ready():

I couldn't find a solution to my problem, so I came here. Thanks in advance!

in Engine by (174 points)
edited by

2 Answers

0 votes
Best answer

You can do it with signal.

animplayer.connect("finished", get_node("/root/globals"), "setScene", ["res://Scenes/levelselect.scn"])"AnimationPlayer")
by (9,800 points)
selected by
+1 vote

You can call functions with your animation just by pressing the '+' in the bottom right corner in the animation setup. So if you just make a function in your script, then you can call that function when the animation is over.

by (154 points)
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.