Wait Time
Part of the Game Rules section of Coddy's Godot journey. Lesson 3 of 29.
A timer's wait_time is how many seconds it counts. It is 1 unless you change it.
$Timer.wait_time = 3 # runs out every three seconds
$Timer.wait_time = 0.25 # four times a secondA smaller wait_time makes the timer run out more often. Set it in _ready(), before the timer starts. The timer reads it each time it starts counting.
Use it to set the pace of a game, like how often enemies appear.
Challenge
EasyThe gate rises too slowly. Set $Timer.wait_time to 0.5 in _ready(), so the timer runs out every half second.
Try it yourself
extends Node2D
func _ready():
$Timer.timeout.connect(_on_timer_timeout)
func _process(delta):
if Input.is_action_just_pressed("action"):
$Timer.start()
func _on_timer_timeout():
$Gate.position.y -= 35
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Game Rules
Practice on your own: Godot playground