Struct Timer
A countdown timer.
struct Timer
;
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
Properties
| Name | Type | Description |
|---|---|---|
autostart[get, set]
|
bool | If true, the timer will automatically start when entering the scene tree.
Note: This property is automatically set to false after the timer enters the scene tree and starts.
|
oneShot[get, set]
|
bool | If true, the timer will stop when reaching 0. If false, it will restart.
|
paused[get, set]
|
bool | If true, the timer is paused and will not process until it is unpaused again, even if start is called.
|
processMode[get, set]
|
Timer | Processing mode. See timerprocessmode.
|
timeLeft[get]
|
double | The timer's remaining time in seconds. Returns 0 if the timer is inactive.
Note: You cannot set this value. To change the timer's remaining time, use start.
|
waitTime[get, set]
|
double | Wait time in seconds. |
Methods
| Name | Description |
|---|---|
getTimeLeft
|
|
getTimerProcessMode
|
|
getWaitTime
|
|
hasAutostart
|
|
isOneShot
|
|
isPaused
|
|
isStopped
|
Returns true if the timer is stopped.
|
setAutostart
|
|
setOneShot
|
|
setPaused
|
|
setTimerProcessMode
|
|
setWaitTime
|
|
start
|
Starts the timer. Sets wait_time to time_sec if time_sec > 0. This also resets the remaining time to wait_time.
Note: this method will not resume a paused timer. See paused.
|
stop
|
Stops the timer. |
Enums
| Name | Description |
|---|---|
Constants
|
|
TimerProcessMode
|