2
0

VisibleOnScreenNotifier2D.xml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisibleOnScreenNotifier2D" inherits="Node2D" version="4.0">
  3. <brief_description>
  4. Detects when the node extents are visible on screen.
  5. </brief_description>
  6. <description>
  7. 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.
  8. If you want nodes to be disabled automatically when they exit the screen, use [VisibleOnScreenEnabler2D] instead.
  9. </description>
  10. <tutorials>
  11. <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
  12. </tutorials>
  13. <methods>
  14. <method name="is_on_screen" qualifiers="const">
  15. <return type="bool" />
  16. <description>
  17. If [code]true[/code], the bounding rectangle is on the screen.
  18. [b]Note:[/b] It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return [code]false[/code] right after it is instantiated, even if it will be on screen in the draw pass.
  19. </description>
  20. </method>
  21. </methods>
  22. <members>
  23. <member name="rect" type="Rect2" setter="set_rect" getter="get_rect" default="Rect2(-10, -10, 20, 20)">
  24. The VisibleOnScreenNotifier2D's bounding rectangle.
  25. </member>
  26. </members>
  27. <signals>
  28. <signal name="screen_entered">
  29. <description>
  30. Emitted when the VisibleOnScreenNotifier2D enters the screen.
  31. </description>
  32. </signal>
  33. <signal name="screen_exited">
  34. <description>
  35. Emitted when the VisibleOnScreenNotifier2D exits the screen.
  36. </description>
  37. </signal>
  38. </signals>
  39. </class>