Topic was automatically imported from the old Question2Answer platform.
Asked By
Tomc47
Hey there everybody,
so some context
when i press the play button from the main menu,
it will go to the game level,
when that happens i want a 3 second countdown timer to countdown to zero before the player can actually play the level,
best example i can think of is the countdowntimer in sonic air riders on the ps2 that would count down before the player could begin the race, only i want the player to only be able to play the game after the 3 second countdown,
what i have:
is a control node, then child to that is the label node, then child to that is a timer node,
when the timer reaches zero i also want it to disappear from the screen so a temporary countdown timer as well.
Hello,
for the timer countdown I leave you with a link that I think can help you: Timer CountDown
For the part where the player can’t play until the countdown is over, I recommend pausing the game and putting the timer on the pause process mode tab, and that when that time has passed, start the game and you change the visibility of the timer (this is done by putting in the code the name of the node that represents the timer and adding to it .visibility = hidden or invisible) and it would be done. I hope these tips help you.
Mxt08
use the Timer node.
add it as a child node to your level.
set it’s wait time property to 1 second.
go to the signals tab of the node and connect the timeout() signal to what ever script you want to use for it, just make sure you can access the timer node from the script.
in the script create an integer variable with the value of 3.
in the signaled function, reduce the value of your variable by one, check wether it’s reached 0 and if not, restart the timer, else you can start the game.
the script then should look something like this:
func timeout_signal():
countdown -= 1
if not countdown == 0:
$Label.text = str(countdown)+"!!!"
$Timer.start()
else:
start_my_super_cool_game()