class_parallaxbackground.rst 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ParallaxBackground.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ParallaxBackground:
  6. ParallaxBackground
  7. ==================
  8. **Inherits:** :ref:`CanvasLayer<class_CanvasLayer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. A node used to create a parallax scrolling background.
  10. Description
  11. -----------
  12. 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>`.
  13. Properties
  14. ----------
  15. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  16. | :ref:`int<class_int>` | layer | ``-100`` *(parent override)* |
  17. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  18. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_offset<class_ParallaxBackground_property_scroll_base_offset>` | ``Vector2( 0, 0 )`` |
  19. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  20. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_base_scale<class_ParallaxBackground_property_scroll_base_scale>` | ``Vector2( 1, 1 )`` |
  21. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`scroll_ignore_camera_zoom<class_ParallaxBackground_property_scroll_ignore_camera_zoom>` | ``false`` |
  23. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  24. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_begin<class_ParallaxBackground_property_scroll_limit_begin>` | ``Vector2( 0, 0 )`` |
  25. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_limit_end<class_ParallaxBackground_property_scroll_limit_end>` | ``Vector2( 0, 0 )`` |
  27. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  28. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_ParallaxBackground_property_scroll_offset>` | ``Vector2( 0, 0 )`` |
  29. +-------------------------------+-----------------------------------------------------------------------------------------------+------------------------------+
  30. Property Descriptions
  31. ---------------------
  32. .. _class_ParallaxBackground_property_scroll_base_offset:
  33. - :ref:`Vector2<class_Vector2>` **scroll_base_offset**
  34. +-----------+-------------------------------+
  35. | *Default* | ``Vector2( 0, 0 )`` |
  36. +-----------+-------------------------------+
  37. | *Setter* | set_scroll_base_offset(value) |
  38. +-----------+-------------------------------+
  39. | *Getter* | get_scroll_base_offset() |
  40. +-----------+-------------------------------+
  41. The base position offset for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  42. ----
  43. .. _class_ParallaxBackground_property_scroll_base_scale:
  44. - :ref:`Vector2<class_Vector2>` **scroll_base_scale**
  45. +-----------+------------------------------+
  46. | *Default* | ``Vector2( 1, 1 )`` |
  47. +-----------+------------------------------+
  48. | *Setter* | set_scroll_base_scale(value) |
  49. +-----------+------------------------------+
  50. | *Getter* | get_scroll_base_scale() |
  51. +-----------+------------------------------+
  52. The base motion scale for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  53. ----
  54. .. _class_ParallaxBackground_property_scroll_ignore_camera_zoom:
  55. - :ref:`bool<class_bool>` **scroll_ignore_camera_zoom**
  56. +-----------+-------------------------------+
  57. | *Default* | ``false`` |
  58. +-----------+-------------------------------+
  59. | *Setter* | set_ignore_camera_zoom(value) |
  60. +-----------+-------------------------------+
  61. | *Getter* | is_ignore_camera_zoom() |
  62. +-----------+-------------------------------+
  63. If ``true``, elements in :ref:`ParallaxLayer<class_ParallaxLayer>` child aren't affected by the zoom level of the camera.
  64. ----
  65. .. _class_ParallaxBackground_property_scroll_limit_begin:
  66. - :ref:`Vector2<class_Vector2>` **scroll_limit_begin**
  67. +-----------+------------------------+
  68. | *Default* | ``Vector2( 0, 0 )`` |
  69. +-----------+------------------------+
  70. | *Setter* | set_limit_begin(value) |
  71. +-----------+------------------------+
  72. | *Getter* | get_limit_begin() |
  73. +-----------+------------------------+
  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. ----
  76. .. _class_ParallaxBackground_property_scroll_limit_end:
  77. - :ref:`Vector2<class_Vector2>` **scroll_limit_end**
  78. +-----------+----------------------+
  79. | *Default* | ``Vector2( 0, 0 )`` |
  80. +-----------+----------------------+
  81. | *Setter* | set_limit_end(value) |
  82. +-----------+----------------------+
  83. | *Getter* | get_limit_end() |
  84. +-----------+----------------------+
  85. 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.
  86. ----
  87. .. _class_ParallaxBackground_property_scroll_offset:
  88. - :ref:`Vector2<class_Vector2>` **scroll_offset**
  89. +-----------+--------------------------+
  90. | *Default* | ``Vector2( 0, 0 )`` |
  91. +-----------+--------------------------+
  92. | *Setter* | set_scroll_offset(value) |
  93. +-----------+--------------------------+
  94. | *Getter* | get_scroll_offset() |
  95. +-----------+--------------------------+
  96. 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.
  97. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  98. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  99. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`