class_scenetreetimer.rst 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the SceneTreeTimer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_SceneTreeTimer:
  6. SceneTreeTimer
  7. ==============
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. One-shot timer.
  10. Description
  11. -----------
  12. A one-shot timer managed by the scene tree, which emits :ref:`timeout<class_SceneTreeTimer_signal_timeout>` on completion. See also :ref:`SceneTree.create_timer<class_SceneTree_method_create_timer>`.
  13. As opposed to :ref:`Timer<class_Timer>`, it does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example:
  14. ::
  15. func some_function():
  16. print("Timer started.")
  17. yield(get_tree().create_timer(1.0), "timeout")
  18. print("Timer ended.")
  19. Properties
  20. ----------
  21. +---------------------------+-----------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`time_left<class_SceneTreeTimer_property_time_left>` |
  23. +---------------------------+-----------------------------------------------------------+
  24. Signals
  25. -------
  26. .. _class_SceneTreeTimer_signal_timeout:
  27. - **timeout** **(** **)**
  28. Emitted when the timer reaches 0.
  29. Property Descriptions
  30. ---------------------
  31. .. _class_SceneTreeTimer_property_time_left:
  32. - :ref:`float<class_float>` **time_left**
  33. +----------+----------------------+
  34. | *Setter* | set_time_left(value) |
  35. +----------+----------------------+
  36. | *Getter* | get_time_left() |
  37. +----------+----------------------+
  38. The time remaining.
  39. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  40. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  41. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`