2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "Timer" inherits= "Node" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
A countdown timer.
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
2021-03-18 19:04:28 +08:00
[b]Note:[/b] To create a one-shot timer without instantiating a node, use [method SceneTree.create_timer].
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2020-10-01 16:34:47 +08:00
<link title= "2D Dodge The Creeps Demo" > https://godotengine.org/asset-library/asset/515</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<methods >
<method name= "is_stopped" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2017-12-30 09:08:54 +08:00
Returns [code]true[/code] if the timer is stopped.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "start" >
<return type= "void" >
</return>
2018-04-27 03:42:50 +08:00
<argument index= "0" name= "time_sec" type= "float" default= "-1" >
</argument>
2017-09-13 04:42:36 +08:00
<description >
2018-12-29 07:17:09 +08:00
Starts the timer. Sets [code]wait_time[/code] to [code]time_sec[/code] if [code]time_sec > 0[/code]. This also resets the remaining time to [code]wait_time[/code].
2019-06-22 07:04:47 +08:00
[b]Note:[/b] this method will not resume a paused timer. See [member paused].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "stop" >
<return type= "void" >
</return>
<description >
2018-09-17 01:52:21 +08:00
Stops the timer.
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "autostart" type= "bool" setter= "set_autostart" getter= "has_autostart" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], the timer will automatically start when entering the scene tree.
2020-01-19 17:18:09 +08:00
[b]Note:[/b] This property is automatically set to [code]false[/code] after the timer enters the scene tree and starts.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "one_shot" type= "bool" setter= "set_one_shot" getter= "is_one_shot" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], the timer will stop when reaching 0. If [code]false[/code], it will restart.
2017-09-13 04:42:36 +08:00
</member>
2019-06-30 03:22:15 +08:00
<member name= "paused" type= "bool" setter= "set_paused" getter= "is_paused" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the timer is paused and will not process until it is unpaused again, even if [method start] is called.
2018-01-12 06:38:35 +08:00
</member>
2021-02-19 20:35:31 +08:00
<member name= "process_callback" type= "int" setter= "set_timer_process_callback" getter= "get_timer_process_callback" enum= "Timer.TimerProcessCallback" default= "1" >
Processing callback. See [enum TimerProcessCallback].
2017-09-13 04:42:36 +08:00
</member>
2019-06-30 03:22:15 +08:00
<member name= "time_left" type= "float" setter= "" getter= "get_time_left" >
2018-01-12 06:38:35 +08:00
The timer's remaining time in seconds. Returns 0 if the timer is inactive.
2020-01-02 09:08:19 +08:00
[b]Note:[/b] You cannot set this value. To change the timer's remaining time, use [method start].
2018-01-12 06:38:35 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "wait_time" type= "float" setter= "set_wait_time" getter= "get_wait_time" default= "1.0" >
2017-09-13 04:42:36 +08:00
Wait time in seconds.
</member>
</members>
<signals >
<signal name= "timeout" >
<description >
2018-09-17 01:52:21 +08:00
Emitted when the timer reaches 0.
2017-09-13 04:42:36 +08:00
</description>
</signal>
</signals>
<constants >
2021-02-19 20:35:31 +08:00
<constant name= "TIMER_PROCESS_PHYSICS" value= "0" enum= "TimerProcessCallback" >
2018-09-17 01:52:21 +08:00
Update the timer during the physics step at each frame (fixed framerate processing).
2017-09-13 04:42:36 +08:00
</constant>
2021-02-19 20:35:31 +08:00
<constant name= "TIMER_PROCESS_IDLE" value= "1" enum= "TimerProcessCallback" >
2018-09-17 01:52:21 +08:00
Update the timer during the idle time at each frame.
2017-09-13 04:42:36 +08:00
</constant>
</constants>
</class>