A countdown timer.
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
Note: To create an one-shot timer without instantiating a node, use SceneTree.create_timer.
| bool | autostart | false |
| bool | one_shot | false |
| bool | paused | |
| TimerProcessMode | process_mode | 1 |
| float | time_left | |
| float | wait_time | 1.0 |
| bool | is_stopped ( ) const |
| void | start ( float time_sec=-1 ) |
| void | stop ( ) |
Emitted when the timer reaches 0.
enum TimerProcessMode:
| Default | false |
| Setter | set_autostart(value) |
| Getter | has_autostart() |
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.
| Default | false |
| Setter | set_one_shot(value) |
| Getter | is_one_shot() |
If true, the timer will stop when reaching 0. If false, it will restart.
| Setter | set_paused(value) |
| Getter | is_paused() |
If true, the timer is paused and will not process until it is unpaused again, even if start is called.
| Default | 1 |
| Setter | set_timer_process_mode(value) |
| Getter | get_timer_process_mode() |
Processing mode. See TimerProcessMode.
| Getter | get_time_left() |
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.
| Default | 1.0 |
| Setter | set_wait_time(value) |
| Getter | get_wait_time() |
Wait time in seconds.
Returns true if the timer is stopped.
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.
Stops the timer.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_timer.html