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!

asked Dec 21, 2018 in Engine by Rob1980 (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!

answered Dec 21, 2018 by Jowan-Spooner (758 points)
selected Dec 22, 2018 by Rob1980

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.