class_parallaxbackground.rst 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A node used to create a parallax scrolling background.
  13. Properties
  14. ----------
  15. +-------------------------------+-----------------------------------------------------------------------------------------------+-----------------+
  16. | :ref:`int<class_int>` | layer | **O:** -100 |
  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. Description
  31. -----------
  32. 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>`.
  33. Property Descriptions
  34. ---------------------
  35. .. _class_ParallaxBackground_property_scroll_base_offset:
  36. - :ref:`Vector2<class_Vector2>` **scroll_base_offset**
  37. +-----------+-------------------------------+
  38. | *Default* | Vector2( 0, 0 ) |
  39. +-----------+-------------------------------+
  40. | *Setter* | set_scroll_base_offset(value) |
  41. +-----------+-------------------------------+
  42. | *Getter* | get_scroll_base_offset() |
  43. +-----------+-------------------------------+
  44. The base position offset for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  45. .. _class_ParallaxBackground_property_scroll_base_scale:
  46. - :ref:`Vector2<class_Vector2>` **scroll_base_scale**
  47. +-----------+------------------------------+
  48. | *Default* | Vector2( 1, 1 ) |
  49. +-----------+------------------------------+
  50. | *Setter* | set_scroll_base_scale(value) |
  51. +-----------+------------------------------+
  52. | *Getter* | get_scroll_base_scale() |
  53. +-----------+------------------------------+
  54. The base motion scale for all :ref:`ParallaxLayer<class_ParallaxLayer>` children.
  55. .. _class_ParallaxBackground_property_scroll_ignore_camera_zoom:
  56. - :ref:`bool<class_bool>` **scroll_ignore_camera_zoom**
  57. +-----------+-------------------------------+
  58. | *Default* | false |
  59. +-----------+-------------------------------+
  60. | *Setter* | set_ignore_camera_zoom(value) |
  61. +-----------+-------------------------------+
  62. | *Getter* | is_ignore_camera_zoom() |
  63. +-----------+-------------------------------+
  64. If ``true``, elements in :ref:`ParallaxLayer<class_ParallaxLayer>` child aren't affected by the zoom level of the camera.
  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. .. _class_ParallaxBackground_property_scroll_limit_end:
  76. - :ref:`Vector2<class_Vector2>` **scroll_limit_end**
  77. +-----------+----------------------+
  78. | *Default* | Vector2( 0, 0 ) |
  79. +-----------+----------------------+
  80. | *Setter* | set_limit_end(value) |
  81. +-----------+----------------------+
  82. | *Getter* | get_limit_end() |
  83. +-----------+----------------------+
  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. .. _class_ParallaxBackground_property_scroll_offset:
  86. - :ref:`Vector2<class_Vector2>` **scroll_offset**
  87. +-----------+--------------------------+
  88. | *Default* | Vector2( 0, 0 ) |
  89. +-----------+--------------------------+
  90. | *Setter* | set_scroll_offset(value) |
  91. +-----------+--------------------------+
  92. | *Getter* | get_scroll_offset() |
  93. +-----------+--------------------------+
  94. 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.