Hey all, I’m making a game where I’m trying to code an animation whenever you click on an object. Specifically, when you click on the object, it will go to the center of your screen, wait a second, then slowly fade out.
For the part where you wait a second, the code is here:
if global_position == Vector2(525,325) && GoAhead == false: #Checks if the object is in the right spot, and if it hasn't done this already
$Sprite2D/Sprite1.self_modulate.a = 0 #Changing from one sprite to another
$AnimatedSprite2D.self_modulate.a = 1
$Timer.wait_time(1)
GoAhead = true
However, when I run that code, and get to the part where the timer is about to trigger, I get this error message:
E 0:00:01:772 _process: Invalid call. Nonexistent function 'wait_time' in base 'Timer_'
I kno…
Hey all, I’m making a game where I’m trying to code an animation whenever you click on an object. Specifically, when you click on the object, it will go to the center of your screen, wait a second, then slowly fade out.
For the part where you wait a second, the code is here:
if global_position == Vector2(525,325) && GoAhead == false: #Checks if the object is in the right spot, and if it hasn't done this already
$Sprite2D/Sprite1.self_modulate.a = 0 #Changing from one sprite to another
$AnimatedSprite2D.self_modulate.a = 1
$Timer.wait_time(1)
GoAhead = true
However, when I run that code, and get to the part where the timer is about to trigger, I get this error message:
E 0:00:01:772 _process: Invalid call. Nonexistent function 'wait_time' in base 'Timer_'
I know the function in question does exist, because when I was writing out the code in-engine, it autofilled that part for me, and I was able to find documentation from godot detailing how to use the function.
This code is running in a Node2D, which houses all the other nodes in the scene for this object (including the Sprite2D, AnimatedSprite2D, and Timer nodes). Could this be a syntax error? Or would this code only work in the Timer node?