class_scenetreetimer.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. One-shot timer.
  13. Properties
  14. ----------
  15. +---------------------------+-----------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`time_left<class_SceneTreeTimer_property_time_left>` |
  17. +---------------------------+-----------------------------------------------------------+
  18. Signals
  19. -------
  20. .. _class_SceneTreeTimer_signal_timeout:
  21. - **timeout** **(** **)**
  22. Emitted when the timer reaches 0.
  23. Description
  24. -----------
  25. 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>`.
  26. 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:
  27. ::
  28. func some_function():
  29. print("start")
  30. yield(get_tree().create_timer(1.0), "timeout")
  31. print("end")
  32. Property Descriptions
  33. ---------------------
  34. .. _class_SceneTreeTimer_property_time_left:
  35. - :ref:`float<class_float>` **time_left**
  36. +----------+----------------------+
  37. | *Setter* | set_time_left(value) |
  38. +----------+----------------------+
  39. | *Getter* | get_time_left() |
  40. +----------+----------------------+
  41. The time remaining.