class_visibleonscreennotifier2d.rst 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 VisibleOnScreenNotifier2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisibleOnScreenNotifier2D:
  6. VisibleOnScreenNotifier2D
  7. =========================
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`VisibleOnScreenEnabler2D<class_VisibleOnScreenEnabler2D>`
  10. Detects when the node extents are visible on screen.
  11. Description
  12. -----------
  13. The VisibleOnScreenNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
  14. If you want nodes to be disabled automatically when they exit the screen, use :ref:`VisibleOnScreenEnabler2D<class_VisibleOnScreenEnabler2D>` instead.
  15. Tutorials
  16. ---------
  17. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
  18. Properties
  19. ----------
  20. +---------------------------+------------------------------------------------------------+-----------------------------+
  21. | :ref:`Rect2<class_Rect2>` | :ref:`rect<class_VisibleOnScreenNotifier2D_property_rect>` | ``Rect2(-10, -10, 20, 20)`` |
  22. +---------------------------+------------------------------------------------------------+-----------------------------+
  23. Methods
  24. -------
  25. +-------------------------+----------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibleOnScreenNotifier2D_method_is_on_screen>` **(** **)** |const| |
  27. +-------------------------+----------------------------------------------------------------------------------------------+
  28. Signals
  29. -------
  30. .. _class_VisibleOnScreenNotifier2D_signal_screen_entered:
  31. - **screen_entered** **(** **)**
  32. Emitted when the VisibleOnScreenNotifier2D enters the screen.
  33. ----
  34. .. _class_VisibleOnScreenNotifier2D_signal_screen_exited:
  35. - **screen_exited** **(** **)**
  36. Emitted when the VisibleOnScreenNotifier2D exits the screen.
  37. Property Descriptions
  38. ---------------------
  39. .. _class_VisibleOnScreenNotifier2D_property_rect:
  40. - :ref:`Rect2<class_Rect2>` **rect**
  41. +-----------+-----------------------------+
  42. | *Default* | ``Rect2(-10, -10, 20, 20)`` |
  43. +-----------+-----------------------------+
  44. | *Setter* | set_rect(value) |
  45. +-----------+-----------------------------+
  46. | *Getter* | get_rect() |
  47. +-----------+-----------------------------+
  48. The VisibleOnScreenNotifier2D's bounding rectangle.
  49. Method Descriptions
  50. -------------------
  51. .. _class_VisibleOnScreenNotifier2D_method_is_on_screen:
  52. - :ref:`bool<class_bool>` **is_on_screen** **(** **)** |const|
  53. If ``true``, the bounding rectangle is on the screen.
  54. \ **Note:** It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return ``false`` right after it is instantiated, even if it will be on screen in the draw pass.
  55. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  56. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  57. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  58. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  59. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  60. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`