class_parallaxbackground.rst 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. **Inherits:** :ref:`CanvasLayer<class_CanvasLayer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node used to create a parallax scrolling background.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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>`.
  15. \ **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.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | layer | ``-100`` (overrides :ref:`CanvasLayer<class_CanvasLayer_property_layer>`) |
  23. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  24. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_offset<class_ParallaxBackground_property_scroll_base_offset>` | ``Vector2(0, 0)`` |
  25. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_scale<class_ParallaxBackground_property_scroll_base_scale>` | ``Vector2(1, 1)`` |
  27. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`scroll_ignore_camera_zoom<class_ParallaxBackground_property_scroll_ignore_camera_zoom>` | ``false`` |
  29. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  30. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` | ``Vector2(0, 0)`` |
  31. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  32. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` | ``Vector2(0, 0)`` |
  33. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  34. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>` | ``Vector2(0, 0)`` |
  35. +-------------------------------+-----------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Property Descriptions
  40. ---------------------
  41. .. _class_ParallaxBackground_property_scroll_base_offset:
  42. .. rst-class:: classref-property
  43. :ref:`Vector2<class_Vector2>` **scroll_base_offset** = ``Vector2(0, 0)``
  44. .. rst-class:: classref-property-setget
  45. - void **set_scroll_base_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  46. - :ref:`Vector2<class_Vector2>` **get_scroll_base_offset** **(** **)**
  47. The base position offset for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  48. .. rst-class:: classref-item-separator
  49. ----
  50. .. _class_ParallaxBackground_property_scroll_base_scale:
  51. .. rst-class:: classref-property
  52. :ref:`Vector2<class_Vector2>` **scroll_base_scale** = ``Vector2(1, 1)``
  53. .. rst-class:: classref-property-setget
  54. - void **set_scroll_base_scale** **(** :ref:`Vector2<class_Vector2>` value **)**
  55. - :ref:`Vector2<class_Vector2>` **get_scroll_base_scale** **(** **)**
  56. The base motion scale for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_ParallaxBackground_property_scroll_ignore_camera_zoom:
  60. .. rst-class:: classref-property
  61. :ref:`bool<class_bool>` **scroll_ignore_camera_zoom** = ``false``
  62. .. rst-class:: classref-property-setget
  63. - void **set_ignore_camera_zoom** **(** :ref:`bool<class_bool>` value **)**
  64. - :ref:`bool<class_bool>` **is_ignore_camera_zoom** **(** **)**
  65. If ``true``, elements in :ref:`ParallaxLayer<class_ParallaxLayer>` child aren't affected by the zoom level of the camera.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_ParallaxBackground_property_scroll_limit_begin:
  69. .. rst-class:: classref-property
  70. :ref:`Vector2<class_Vector2>` **scroll_limit_begin** = ``Vector2(0, 0)``
  71. .. rst-class:: classref-property-setget
  72. - void **set_limit_begin** **(** :ref:`Vector2<class_Vector2>` value **)**
  73. - :ref:`Vector2<class_Vector2>` **get_limit_begin** **(** **)**
  74. 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.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_ParallaxBackground_property_scroll_limit_end:
  78. .. rst-class:: classref-property
  79. :ref:`Vector2<class_Vector2>` **scroll_limit_end** = ``Vector2(0, 0)``
  80. .. rst-class:: classref-property-setget
  81. - void **set_limit_end** **(** :ref:`Vector2<class_Vector2>` value **)**
  82. - :ref:`Vector2<class_Vector2>` **get_limit_end** **(** **)**
  83. 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.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_ParallaxBackground_property_scroll_offset:
  87. .. rst-class:: classref-property
  88. :ref:`Vector2<class_Vector2>` **scroll_offset** = ``Vector2(0, 0)``
  89. .. rst-class:: classref-property-setget
  90. - void **set_scroll_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  91. - :ref:`Vector2<class_Vector2>` **get_scroll_offset** **(** **)**
  92. 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.
  93. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  94. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  95. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  96. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  97. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  98. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  99. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`