class_parallaxbackground.rst 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ParallaxBackground.xml.
  6. .. _class_ParallaxBackground:
  7. ParallaxBackground
  8. ==================
  9. **Deprecated:** Use the :ref:`Parallax2D<class_Parallax2D>` node instead.
  10. **Inherits:** :ref:`CanvasLayer<class_CanvasLayer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. A node used to create a parallax scrolling background.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. A ParallaxBackground uses one or more :ref:`ParallaxLayer<class_ParallaxLayer>` child nodes to create a parallax effect. Each :ref:`ParallaxLayer<class_ParallaxLayer>` can move at a different speed using :ref:`ParallaxLayer.motion_offset<class_ParallaxLayer_property_motion_offset>`. This creates an illusion of depth in a 2D game. If not used with a :ref:`Camera2D<class_Camera2D>`, you must manually calculate the :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>`.
  16. \ **Note:** Each **ParallaxBackground** is drawn on one specific :ref:`Viewport<class_Viewport>` and cannot be shared between multiple :ref:`Viewport<class_Viewport>`\ s, see :ref:`CanvasLayer.custom_viewport<class_CanvasLayer_property_custom_viewport>`. When using multiple :ref:`Viewport<class_Viewport>`\ s, for example in a split-screen game, you need create an individual **ParallaxBackground** for each :ref:`Viewport<class_Viewport>` you want it to be drawn on.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | layer | ``-100`` (overrides :ref:`CanvasLayer<class_CanvasLayer_property_layer>`) |
  24. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_offset<class_ParallaxBackground_property_scroll_base_offset>` | ``Vector2(0, 0)`` |
  26. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  27. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_scale<class_ParallaxBackground_property_scroll_base_scale>` | ``Vector2(1, 1)`` |
  28. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`scroll_ignore_camera_zoom<class_ParallaxBackground_property_scroll_ignore_camera_zoom>` | ``false`` |
  30. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  31. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` | ``Vector2(0, 0)`` |
  32. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  33. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` | ``Vector2(0, 0)`` |
  34. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  35. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>` | ``Vector2(0, 0)`` |
  36. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  37. .. rst-class:: classref-section-separator
  38. ----
  39. .. rst-class:: classref-descriptions-group
  40. Property Descriptions
  41. ---------------------
  42. .. _class_ParallaxBackground_property_scroll_base_offset:
  43. .. rst-class:: classref-property
  44. :ref:`Vector2<class_Vector2>` **scroll_base_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxBackground_property_scroll_base_offset>`
  45. .. rst-class:: classref-property-setget
  46. - |void| **set_scroll_base_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  47. - :ref:`Vector2<class_Vector2>` **get_scroll_base_offset**\ (\ )
  48. The base position offset for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  49. .. rst-class:: classref-item-separator
  50. ----
  51. .. _class_ParallaxBackground_property_scroll_base_scale:
  52. .. rst-class:: classref-property
  53. :ref:`Vector2<class_Vector2>` **scroll_base_scale** = ``Vector2(1, 1)`` :ref:`🔗<class_ParallaxBackground_property_scroll_base_scale>`
  54. .. rst-class:: classref-property-setget
  55. - |void| **set_scroll_base_scale**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  56. - :ref:`Vector2<class_Vector2>` **get_scroll_base_scale**\ (\ )
  57. The base motion scale for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_ParallaxBackground_property_scroll_ignore_camera_zoom:
  61. .. rst-class:: classref-property
  62. :ref:`bool<class_bool>` **scroll_ignore_camera_zoom** = ``false`` :ref:`🔗<class_ParallaxBackground_property_scroll_ignore_camera_zoom>`
  63. .. rst-class:: classref-property-setget
  64. - |void| **set_ignore_camera_zoom**\ (\ value\: :ref:`bool<class_bool>`\ )
  65. - :ref:`bool<class_bool>` **is_ignore_camera_zoom**\ (\ )
  66. If ``true``, elements in :ref:`ParallaxLayer<class_ParallaxLayer>` child aren't affected by the zoom level of the camera.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_ParallaxBackground_property_scroll_limit_begin:
  70. .. rst-class:: classref-property
  71. :ref:`Vector2<class_Vector2>` **scroll_limit_begin** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxBackground_property_scroll_limit_begin>`
  72. .. rst-class:: classref-property-setget
  73. - |void| **set_limit_begin**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  74. - :ref:`Vector2<class_Vector2>` **get_limit_begin**\ (\ )
  75. Top-left limits for scrolling to begin. If the camera is outside of this limit, the background will stop scrolling. Must be lower than :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` to work.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_ParallaxBackground_property_scroll_limit_end:
  79. .. rst-class:: classref-property
  80. :ref:`Vector2<class_Vector2>` **scroll_limit_end** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxBackground_property_scroll_limit_end>`
  81. .. rst-class:: classref-property-setget
  82. - |void| **set_limit_end**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  83. - :ref:`Vector2<class_Vector2>` **get_limit_end**\ (\ )
  84. Bottom-right limits for scrolling to end. If the camera is outside of this limit, the background will stop scrolling. Must be higher than :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` to work.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_ParallaxBackground_property_scroll_offset:
  88. .. rst-class:: classref-property
  89. :ref:`Vector2<class_Vector2>` **scroll_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_ParallaxBackground_property_scroll_offset>`
  90. .. rst-class:: classref-property-setget
  91. - |void| **set_scroll_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  92. - :ref:`Vector2<class_Vector2>` **get_scroll_offset**\ (\ )
  93. The ParallaxBackground's scroll value. Calculated automatically when using a :ref:`Camera2D<class_Camera2D>`, but can be used to manually manage scrolling when no camera is present.
  94. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  95. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  96. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  97. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  98. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  99. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  100. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  101. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  102. .. |void| replace:: :abbr:`void (No return value.)`