0 votes

Hi everyone! Today I have two problems to solve, both related to the timer: I created a 2D runner game, and I would like the words "Get ready!" to appear before the game begins. Also, I would like to create a countdown consisting of minutes and seconds.
Thank you so much!

in Engine by (70 points)

1 Answer

+1 vote
Best answer

That doesn't really sounds like problems, but here's the answer anyway:

  1. Create a Timer (one shot = false, wait time = 1) and two labels ("Get ready!", "3")
  2. When starting your game write something like this:

    $Label.show()
    $Counter.show() # the second Label
    $Timer.start()
    yield($Timer, "timeout")
    $Counter.text = "2"
    yield($Timer, "timeout")
    $Counter.text = "1"
    yield($Timer, "timeout")
    $Timer.stop()
    $Counter.text = "3"
    $Counter.hide()
    $Label.hide()
    start_game() # or something similar

Good Luck!

by (766 points)
selected by

IT WORKS! Thank you so much! ;-)

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 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 webmaster@godotengine.org with your username.

Categories