class_scenetreetimer.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.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. The timer will be automatically freed after its time elapses.
  20. Properties
  21. ----------
  22. +---------------------------+-----------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`time_left<class_SceneTreeTimer_property_time_left>` |
  24. +---------------------------+-----------------------------------------------------------+
  25. Signals
  26. -------
  27. .. _class_SceneTreeTimer_signal_timeout:
  28. - **timeout** **(** **)**
  29. Emitted when the timer reaches 0.
  30. Property Descriptions
  31. ---------------------
  32. .. _class_SceneTreeTimer_property_time_left:
  33. - :ref:`float<class_float>` **time_left**
  34. +----------+----------------------+
  35. | *Setter* | set_time_left(value) |
  36. +----------+----------------------+
  37. | *Getter* | get_time_left() |
  38. +----------+----------------------+
  39. The time remaining (in seconds).
  40. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  41. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  42. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`