class_timer.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Timer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Timer:
  5. Timer
  6. =====
  7. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A countdown timer.
  12. Member Functions
  13. ----------------
  14. +----------------------------+--------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_time_left<class_Timer_get_time_left>` **(** **)** const |
  16. +----------------------------+--------------------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`is_paused<class_Timer_is_paused>` **(** **)** const |
  18. +----------------------------+--------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`is_stopped<class_Timer_is_stopped>` **(** **)** const |
  20. +----------------------------+--------------------------------------------------------------------------------------+
  21. | void | :ref:`set_paused<class_Timer_set_paused>` **(** :ref:`bool<class_bool>` paused **)** |
  22. +----------------------------+--------------------------------------------------------------------------------------+
  23. | void | :ref:`start<class_Timer_start>` **(** **)** |
  24. +----------------------------+--------------------------------------------------------------------------------------+
  25. | void | :ref:`stop<class_Timer_stop>` **(** **)** |
  26. +----------------------------+--------------------------------------------------------------------------------------+
  27. Signals
  28. -------
  29. .. _class_Timer_timeout:
  30. - **timeout** **(** **)**
  31. Emitted when the Timer reaches 0.
  32. Member Variables
  33. ----------------
  34. .. _class_Timer_autostart:
  35. - :ref:`bool<class_bool>` **autostart** - If ``true``, Timer will automatically start when entering the scene tree. Default value: ``false``.
  36. .. _class_Timer_one_shot:
  37. - :ref:`bool<class_bool>` **one_shot** - If ``true``, Timer will stop when reaching 0. If ``false``, it will restart. Default value: ``false``.
  38. .. _class_Timer_process_mode:
  39. - :ref:`int<class_int>` **process_mode** - Processing mode. Uses TIMER_PROCESS\_\* constants as value.
  40. .. _class_Timer_wait_time:
  41. - :ref:`float<class_float>` **wait_time** - Wait time in seconds.
  42. Numeric Constants
  43. -----------------
  44. - **TIMER_PROCESS_PHYSICS** = **0** --- Update the Timer during the physics step at each frame (fixed framerate processing).
  45. - **TIMER_PROCESS_IDLE** = **1** --- Update the Timer during the idle time at each frame.
  46. Description
  47. -----------
  48. Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one shot" mode.
  49. Member Function Description
  50. ---------------------------
  51. .. _class_Timer_get_time_left:
  52. - :ref:`float<class_float>` **get_time_left** **(** **)** const
  53. Returns the timer's remaining time in seconds. Returns 0 if the timer is inactive.
  54. .. _class_Timer_is_paused:
  55. - :ref:`bool<class_bool>` **is_paused** **(** **)** const
  56. Returns ``true`` if the timer is paused.
  57. .. _class_Timer_is_stopped:
  58. - :ref:`bool<class_bool>` **is_stopped** **(** **)** const
  59. Returns ``true`` if the timer is stopped.
  60. .. _class_Timer_set_paused:
  61. - void **set_paused** **(** :ref:`bool<class_bool>` paused **)**
  62. Pauses the timer. If ``paused`` is ``true``, the timer will not process until it is started or unpaused again, even if :ref:`start<class_Timer_start>` is called.
  63. .. _class_Timer_start:
  64. - void **start** **(** **)**
  65. Starts the timer. This also resets the remaining time to ``wait_time``.
  66. Note: this method will not resume a paused timer. See :ref:`set_paused<class_Timer_set_paused>`.
  67. .. _class_Timer_stop:
  68. - void **stop** **(** **)**
  69. Stop (cancel) the Timer.