class_particles2d.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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 Particles2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Particles2D:
  6. Particles2D
  7. ===========
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. 2D particle emitter.
  13. Properties
  14. ----------
  15. +----------------------------------------------+----------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`amount<class_Particles2D_property_amount>` |
  17. +----------------------------------------------+----------------------------------------------------------------------+
  18. | :ref:`DrawOrder<enum_Particles2D_DrawOrder>` | :ref:`draw_order<class_Particles2D_property_draw_order>` |
  19. +----------------------------------------------+----------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`emitting<class_Particles2D_property_emitting>` |
  21. +----------------------------------------------+----------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`explosiveness<class_Particles2D_property_explosiveness>` |
  23. +----------------------------------------------+----------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`fixed_fps<class_Particles2D_property_fixed_fps>` |
  25. +----------------------------------------------+----------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`fract_delta<class_Particles2D_property_fract_delta>` |
  27. +----------------------------------------------+----------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`lifetime<class_Particles2D_property_lifetime>` |
  29. +----------------------------------------------+----------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`local_coords<class_Particles2D_property_local_coords>` |
  31. +----------------------------------------------+----------------------------------------------------------------------+
  32. | :ref:`Texture<class_Texture>` | :ref:`normal_map<class_Particles2D_property_normal_map>` |
  33. +----------------------------------------------+----------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`one_shot<class_Particles2D_property_one_shot>` |
  35. +----------------------------------------------+----------------------------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`preprocess<class_Particles2D_property_preprocess>` |
  37. +----------------------------------------------+----------------------------------------------------------------------+
  38. | :ref:`Material<class_Material>` | :ref:`process_material<class_Particles2D_property_process_material>` |
  39. +----------------------------------------------+----------------------------------------------------------------------+
  40. | :ref:`float<class_float>` | :ref:`randomness<class_Particles2D_property_randomness>` |
  41. +----------------------------------------------+----------------------------------------------------------------------+
  42. | :ref:`float<class_float>` | :ref:`speed_scale<class_Particles2D_property_speed_scale>` |
  43. +----------------------------------------------+----------------------------------------------------------------------+
  44. | :ref:`Texture<class_Texture>` | :ref:`texture<class_Particles2D_property_texture>` |
  45. +----------------------------------------------+----------------------------------------------------------------------+
  46. | :ref:`Rect2<class_Rect2>` | :ref:`visibility_rect<class_Particles2D_property_visibility_rect>` |
  47. +----------------------------------------------+----------------------------------------------------------------------+
  48. Methods
  49. -------
  50. +---------------------------+------------------------------------------------------------------------------+
  51. | :ref:`Rect2<class_Rect2>` | :ref:`capture_rect<class_Particles2D_method_capture_rect>` **(** **)** const |
  52. +---------------------------+------------------------------------------------------------------------------+
  53. | void | :ref:`restart<class_Particles2D_method_restart>` **(** **)** |
  54. +---------------------------+------------------------------------------------------------------------------+
  55. Enumerations
  56. ------------
  57. .. _enum_Particles2D_DrawOrder:
  58. .. _class_Particles2D_constant_DRAW_ORDER_INDEX:
  59. .. _class_Particles2D_constant_DRAW_ORDER_LIFETIME:
  60. enum **DrawOrder**:
  61. - **DRAW_ORDER_INDEX** = **0** --- Particles are drawn in the order emitted.
  62. - **DRAW_ORDER_LIFETIME** = **1** --- Particles are drawn in order of remaining lifetime.
  63. Description
  64. -----------
  65. 2D particle node used to create a variety of particle systems and effects. ``Particles2D`` features an emitter that generates some number of particles at a given rate.
  66. Use the ``process_material`` property to add a :ref:`ParticlesMaterial<class_ParticlesMaterial>` to configure particle appearance and behavior. Alternatively, you can add a :ref:`ShaderMaterial<class_ShaderMaterial>` which will be applied to all particles.
  67. Tutorials
  68. ---------
  69. - :doc:`../tutorials/2d/particle_systems_2d`
  70. Property Descriptions
  71. ---------------------
  72. .. _class_Particles2D_property_amount:
  73. - :ref:`int<class_int>` **amount**
  74. +----------+-------------------+
  75. | *Setter* | set_amount(value) |
  76. +----------+-------------------+
  77. | *Getter* | get_amount() |
  78. +----------+-------------------+
  79. Number of particles emitted in one emission cycle.
  80. ----
  81. .. _class_Particles2D_property_draw_order:
  82. - :ref:`DrawOrder<enum_Particles2D_DrawOrder>` **draw_order**
  83. +----------+-----------------------+
  84. | *Setter* | set_draw_order(value) |
  85. +----------+-----------------------+
  86. | *Getter* | get_draw_order() |
  87. +----------+-----------------------+
  88. Particle draw order. Uses ``DRAW_ORDER_*`` values. Default value: :ref:`DRAW_ORDER_INDEX<class_Particles2D_constant_DRAW_ORDER_INDEX>`.
  89. ----
  90. .. _class_Particles2D_property_emitting:
  91. - :ref:`bool<class_bool>` **emitting**
  92. +----------+---------------------+
  93. | *Setter* | set_emitting(value) |
  94. +----------+---------------------+
  95. | *Getter* | is_emitting() |
  96. +----------+---------------------+
  97. If ``true``, particles are being emitted. Default value: ``true``.
  98. ----
  99. .. _class_Particles2D_property_explosiveness:
  100. - :ref:`float<class_float>` **explosiveness**
  101. +----------+--------------------------------+
  102. | *Setter* | set_explosiveness_ratio(value) |
  103. +----------+--------------------------------+
  104. | *Getter* | get_explosiveness_ratio() |
  105. +----------+--------------------------------+
  106. How rapidly particles in an emission cycle are emitted. If greater than ``0``, there will be a gap in emissions before the next cycle begins. Default value: ``0``.
  107. ----
  108. .. _class_Particles2D_property_fixed_fps:
  109. - :ref:`int<class_int>` **fixed_fps**
  110. +----------+----------------------+
  111. | *Setter* | set_fixed_fps(value) |
  112. +----------+----------------------+
  113. | *Getter* | get_fixed_fps() |
  114. +----------+----------------------+
  115. The particle system's frame rate is fixed to a value. For instance, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself.
  116. ----
  117. .. _class_Particles2D_property_fract_delta:
  118. - :ref:`bool<class_bool>` **fract_delta**
  119. +----------+-----------------------------+
  120. | *Setter* | set_fractional_delta(value) |
  121. +----------+-----------------------------+
  122. | *Getter* | get_fractional_delta() |
  123. +----------+-----------------------------+
  124. If ``true``, results in fractional delta calculation which has a smoother particles display effect. Default value: ``true``
  125. ----
  126. .. _class_Particles2D_property_lifetime:
  127. - :ref:`float<class_float>` **lifetime**
  128. +----------+---------------------+
  129. | *Setter* | set_lifetime(value) |
  130. +----------+---------------------+
  131. | *Getter* | get_lifetime() |
  132. +----------+---------------------+
  133. Amount of time each particle will exist. Default value: ``1``.
  134. ----
  135. .. _class_Particles2D_property_local_coords:
  136. - :ref:`bool<class_bool>` **local_coords**
  137. +----------+----------------------------------+
  138. | *Setter* | set_use_local_coordinates(value) |
  139. +----------+----------------------------------+
  140. | *Getter* | get_use_local_coordinates() |
  141. +----------+----------------------------------+
  142. If ``true``, particles use the parent node's coordinate space. If ``false``, they use global coordinates. Default value: ``true``.
  143. ----
  144. .. _class_Particles2D_property_normal_map:
  145. - :ref:`Texture<class_Texture>` **normal_map**
  146. +----------+-----------------------+
  147. | *Setter* | set_normal_map(value) |
  148. +----------+-----------------------+
  149. | *Getter* | get_normal_map() |
  150. +----------+-----------------------+
  151. Normal map to be used for the :ref:`texture<class_Particles2D_property_texture>` property.
  152. ----
  153. .. _class_Particles2D_property_one_shot:
  154. - :ref:`bool<class_bool>` **one_shot**
  155. +----------+---------------------+
  156. | *Setter* | set_one_shot(value) |
  157. +----------+---------------------+
  158. | *Getter* | get_one_shot() |
  159. +----------+---------------------+
  160. If ``true``, only one emission cycle occurs. If set ``true`` during a cycle, emission will stop at the cycle's end. Default value: ``false``.
  161. ----
  162. .. _class_Particles2D_property_preprocess:
  163. - :ref:`float<class_float>` **preprocess**
  164. +----------+-----------------------------+
  165. | *Setter* | set_pre_process_time(value) |
  166. +----------+-----------------------------+
  167. | *Getter* | get_pre_process_time() |
  168. +----------+-----------------------------+
  169. Particle system starts as if it had already run for this many seconds.
  170. ----
  171. .. _class_Particles2D_property_process_material:
  172. - :ref:`Material<class_Material>` **process_material**
  173. +----------+-----------------------------+
  174. | *Setter* | set_process_material(value) |
  175. +----------+-----------------------------+
  176. | *Getter* | get_process_material() |
  177. +----------+-----------------------------+
  178. :ref:`Material<class_Material>` for processing particles. Can be a :ref:`ParticlesMaterial<class_ParticlesMaterial>` or a :ref:`ShaderMaterial<class_ShaderMaterial>`.
  179. ----
  180. .. _class_Particles2D_property_randomness:
  181. - :ref:`float<class_float>` **randomness**
  182. +----------+-----------------------------+
  183. | *Setter* | set_randomness_ratio(value) |
  184. +----------+-----------------------------+
  185. | *Getter* | get_randomness_ratio() |
  186. +----------+-----------------------------+
  187. Emission lifetime randomness ratio. Default value: ``0``.
  188. ----
  189. .. _class_Particles2D_property_speed_scale:
  190. - :ref:`float<class_float>` **speed_scale**
  191. +----------+------------------------+
  192. | *Setter* | set_speed_scale(value) |
  193. +----------+------------------------+
  194. | *Getter* | get_speed_scale() |
  195. +----------+------------------------+
  196. Particle system's running speed scaling ratio. Default value: ``1``. A value of ``0`` can be used to pause the particles.
  197. ----
  198. .. _class_Particles2D_property_texture:
  199. - :ref:`Texture<class_Texture>` **texture**
  200. +----------+--------------------+
  201. | *Setter* | set_texture(value) |
  202. +----------+--------------------+
  203. | *Getter* | get_texture() |
  204. +----------+--------------------+
  205. Particle texture. If ``null`` particles will be squares.
  206. ----
  207. .. _class_Particles2D_property_visibility_rect:
  208. - :ref:`Rect2<class_Rect2>` **visibility_rect**
  209. +----------+----------------------------+
  210. | *Setter* | set_visibility_rect(value) |
  211. +----------+----------------------------+
  212. | *Getter* | get_visibility_rect() |
  213. +----------+----------------------------+
  214. Editor visibility helper.
  215. Method Descriptions
  216. -------------------
  217. .. _class_Particles2D_method_capture_rect:
  218. - :ref:`Rect2<class_Rect2>` **capture_rect** **(** **)** const
  219. Returns a rectangle containing the positions of all existing particles.
  220. ----
  221. .. _class_Particles2D_method_restart:
  222. - void **restart** **(** **)**
  223. Restarts all the existing particles.