class_particles2d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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>` | 8 |
  17. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  18. | :ref:`DrawOrder<enum_Particles2D_DrawOrder>` | :ref:`draw_order<class_Particles2D_property_draw_order>` | 0 |
  19. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`emitting<class_Particles2D_property_emitting>` | true |
  21. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  22. | :ref:`float<class_float>` | :ref:`explosiveness<class_Particles2D_property_explosiveness>` | 0.0 |
  23. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  24. | :ref:`int<class_int>` | :ref:`fixed_fps<class_Particles2D_property_fixed_fps>` | 0 |
  25. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`fract_delta<class_Particles2D_property_fract_delta>` | true |
  27. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  28. | :ref:`float<class_float>` | :ref:`lifetime<class_Particles2D_property_lifetime>` | 1.0 |
  29. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`local_coords<class_Particles2D_property_local_coords>` | true |
  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>` | false |
  35. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  36. | :ref:`float<class_float>` | :ref:`preprocess<class_Particles2D_property_preprocess>` | 0.0 |
  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>` | 0.0 |
  41. +----------------------------------------------+----------------------------------------------------------------------+-------------------------------+
  42. | :ref:`float<class_float>` | :ref:`speed_scale<class_Particles2D_property_speed_scale>` | 1.0 |
  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>` | Rect2( -100, -100, 200, 200 ) |
  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. | *Default* | 8 |
  76. +-----------+-------------------+
  77. | *Setter* | set_amount(value) |
  78. +-----------+-------------------+
  79. | *Getter* | get_amount() |
  80. +-----------+-------------------+
  81. Number of particles emitted in one emission cycle.
  82. .. _class_Particles2D_property_draw_order:
  83. - :ref:`DrawOrder<enum_Particles2D_DrawOrder>` **draw_order**
  84. +-----------+-----------------------+
  85. | *Default* | 0 |
  86. +-----------+-----------------------+
  87. | *Setter* | set_draw_order(value) |
  88. +-----------+-----------------------+
  89. | *Getter* | get_draw_order() |
  90. +-----------+-----------------------+
  91. Particle draw order. Uses ``DRAW_ORDER_*`` values.
  92. .. _class_Particles2D_property_emitting:
  93. - :ref:`bool<class_bool>` **emitting**
  94. +-----------+---------------------+
  95. | *Default* | true |
  96. +-----------+---------------------+
  97. | *Setter* | set_emitting(value) |
  98. +-----------+---------------------+
  99. | *Getter* | is_emitting() |
  100. +-----------+---------------------+
  101. If ``true``, particles are being emitted.
  102. .. _class_Particles2D_property_explosiveness:
  103. - :ref:`float<class_float>` **explosiveness**
  104. +-----------+--------------------------------+
  105. | *Default* | 0.0 |
  106. +-----------+--------------------------------+
  107. | *Setter* | set_explosiveness_ratio(value) |
  108. +-----------+--------------------------------+
  109. | *Getter* | get_explosiveness_ratio() |
  110. +-----------+--------------------------------+
  111. 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.
  112. .. _class_Particles2D_property_fixed_fps:
  113. - :ref:`int<class_int>` **fixed_fps**
  114. +-----------+----------------------+
  115. | *Default* | 0 |
  116. +-----------+----------------------+
  117. | *Setter* | set_fixed_fps(value) |
  118. +-----------+----------------------+
  119. | *Getter* | get_fixed_fps() |
  120. +-----------+----------------------+
  121. 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.
  122. .. _class_Particles2D_property_fract_delta:
  123. - :ref:`bool<class_bool>` **fract_delta**
  124. +-----------+-----------------------------+
  125. | *Default* | true |
  126. +-----------+-----------------------------+
  127. | *Setter* | set_fractional_delta(value) |
  128. +-----------+-----------------------------+
  129. | *Getter* | get_fractional_delta() |
  130. +-----------+-----------------------------+
  131. If ``true``, results in fractional delta calculation which has a smoother particles display effect.
  132. .. _class_Particles2D_property_lifetime:
  133. - :ref:`float<class_float>` **lifetime**
  134. +-----------+---------------------+
  135. | *Default* | 1.0 |
  136. +-----------+---------------------+
  137. | *Setter* | set_lifetime(value) |
  138. +-----------+---------------------+
  139. | *Getter* | get_lifetime() |
  140. +-----------+---------------------+
  141. Amount of time each particle will exist.
  142. .. _class_Particles2D_property_local_coords:
  143. - :ref:`bool<class_bool>` **local_coords**
  144. +-----------+----------------------------------+
  145. | *Default* | true |
  146. +-----------+----------------------------------+
  147. | *Setter* | set_use_local_coordinates(value) |
  148. +-----------+----------------------------------+
  149. | *Getter* | get_use_local_coordinates() |
  150. +-----------+----------------------------------+
  151. If ``true``, particles use the parent node's coordinate space. If ``false``, they use global coordinates.
  152. .. _class_Particles2D_property_normal_map:
  153. - :ref:`Texture<class_Texture>` **normal_map**
  154. +----------+-----------------------+
  155. | *Setter* | set_normal_map(value) |
  156. +----------+-----------------------+
  157. | *Getter* | get_normal_map() |
  158. +----------+-----------------------+
  159. Normal map to be used for the :ref:`texture<class_Particles2D_property_texture>` property.
  160. .. _class_Particles2D_property_one_shot:
  161. - :ref:`bool<class_bool>` **one_shot**
  162. +-----------+---------------------+
  163. | *Default* | false |
  164. +-----------+---------------------+
  165. | *Setter* | set_one_shot(value) |
  166. +-----------+---------------------+
  167. | *Getter* | get_one_shot() |
  168. +-----------+---------------------+
  169. If ``true``, only one emission cycle occurs. If set ``true`` during a cycle, emission will stop at the cycle's end.
  170. .. _class_Particles2D_property_preprocess:
  171. - :ref:`float<class_float>` **preprocess**
  172. +-----------+-----------------------------+
  173. | *Default* | 0.0 |
  174. +-----------+-----------------------------+
  175. | *Setter* | set_pre_process_time(value) |
  176. +-----------+-----------------------------+
  177. | *Getter* | get_pre_process_time() |
  178. +-----------+-----------------------------+
  179. Particle system starts as if it had already run for this many seconds.
  180. .. _class_Particles2D_property_process_material:
  181. - :ref:`Material<class_Material>` **process_material**
  182. +----------+-----------------------------+
  183. | *Setter* | set_process_material(value) |
  184. +----------+-----------------------------+
  185. | *Getter* | get_process_material() |
  186. +----------+-----------------------------+
  187. :ref:`Material<class_Material>` for processing particles. Can be a :ref:`ParticlesMaterial<class_ParticlesMaterial>` or a :ref:`ShaderMaterial<class_ShaderMaterial>`.
  188. .. _class_Particles2D_property_randomness:
  189. - :ref:`float<class_float>` **randomness**
  190. +-----------+-----------------------------+
  191. | *Default* | 0.0 |
  192. +-----------+-----------------------------+
  193. | *Setter* | set_randomness_ratio(value) |
  194. +-----------+-----------------------------+
  195. | *Getter* | get_randomness_ratio() |
  196. +-----------+-----------------------------+
  197. Emission lifetime randomness ratio.
  198. .. _class_Particles2D_property_speed_scale:
  199. - :ref:`float<class_float>` **speed_scale**
  200. +-----------+------------------------+
  201. | *Default* | 1.0 |
  202. +-----------+------------------------+
  203. | *Setter* | set_speed_scale(value) |
  204. +-----------+------------------------+
  205. | *Getter* | get_speed_scale() |
  206. +-----------+------------------------+
  207. Particle system's running speed scaling ratio. A value of ``0`` can be used to pause the particles.
  208. .. _class_Particles2D_property_texture:
  209. - :ref:`Texture<class_Texture>` **texture**
  210. +----------+--------------------+
  211. | *Setter* | set_texture(value) |
  212. +----------+--------------------+
  213. | *Getter* | get_texture() |
  214. +----------+--------------------+
  215. Particle texture. If ``null``, particles will be squares.
  216. .. _class_Particles2D_property_visibility_rect:
  217. - :ref:`Rect2<class_Rect2>` **visibility_rect**
  218. +-----------+-------------------------------+
  219. | *Default* | Rect2( -100, -100, 200, 200 ) |
  220. +-----------+-------------------------------+
  221. | *Setter* | set_visibility_rect(value) |
  222. +-----------+-------------------------------+
  223. | *Getter* | get_visibility_rect() |
  224. +-----------+-------------------------------+
  225. Editor visibility helper.
  226. Method Descriptions
  227. -------------------
  228. .. _class_Particles2D_method_capture_rect:
  229. - :ref:`Rect2<class_Rect2>` **capture_rect** **(** **)** const
  230. Returns a rectangle containing the positions of all existing particles.
  231. .. _class_Particles2D_method_restart:
  232. - void **restart** **(** **)**
  233. Restarts all the existing particles.