class_particles2d.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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. 2D particle emitter.
  10. Description
  11. -----------
  12. 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.
  13. 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.
  14. Tutorials
  15. ---------
  16. - :doc:`../tutorials/2d/particle_systems_2d`
  17. Properties
  18. ----------
  19. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  20. | :ref:`int<class_int>` | :ref:`amount<class_Particles2D_property_amount>` | ``8`` |
  21. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  22. | :ref:`DrawOrder<enum_Particles2D_DrawOrder>` | :ref:`draw_order<class_Particles2D_property_draw_order>` | ``0`` |
  23. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`emitting<class_Particles2D_property_emitting>` | ``true`` |
  25. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  26. | :ref:`float<class_float>` | :ref:`explosiveness<class_Particles2D_property_explosiveness>` | ``0.0`` |
  27. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  28. | :ref:`int<class_int>` | :ref:`fixed_fps<class_Particles2D_property_fixed_fps>` | ``0`` |
  29. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`fract_delta<class_Particles2D_property_fract_delta>` | ``true`` |
  31. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  32. | :ref:`float<class_float>` | :ref:`lifetime<class_Particles2D_property_lifetime>` | ``1.0`` |
  33. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`local_coords<class_Particles2D_property_local_coords>` | ``true`` |
  35. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  36. | :ref:`Texture<class_Texture>` | :ref:`normal_map<class_Particles2D_property_normal_map>` | |
  37. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`one_shot<class_Particles2D_property_one_shot>` | ``false`` |
  39. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  40. | :ref:`float<class_float>` | :ref:`preprocess<class_Particles2D_property_preprocess>` | ``0.0`` |
  41. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  42. | :ref:`Material<class_Material>` | :ref:`process_material<class_Particles2D_property_process_material>` | |
  43. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  44. | :ref:`float<class_float>` | :ref:`randomness<class_Particles2D_property_randomness>` | ``0.0`` |
  45. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  46. | :ref:`float<class_float>` | :ref:`speed_scale<class_Particles2D_property_speed_scale>` | ``1.0`` |
  47. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  48. | :ref:`Texture<class_Texture>` | :ref:`texture<class_Particles2D_property_texture>` | |
  49. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  50. | :ref:`Rect2<class_Rect2>` | :ref:`visibility_rect<class_Particles2D_property_visibility_rect>` | ``Rect2( -100, -100, 200, 200 )`` |
  51. +----------------------------------------------+----------------------------------------------------------------------+-----------------------------------+
  52. Methods
  53. -------
  54. +---------------------------+--------------------------------------------------------------------------------+
  55. | :ref:`Rect2<class_Rect2>` | :ref:`capture_rect<class_Particles2D_method_capture_rect>` **(** **)** |const| |
  56. +---------------------------+--------------------------------------------------------------------------------+
  57. | void | :ref:`restart<class_Particles2D_method_restart>` **(** **)** |
  58. +---------------------------+--------------------------------------------------------------------------------+
  59. Enumerations
  60. ------------
  61. .. _enum_Particles2D_DrawOrder:
  62. .. _class_Particles2D_constant_DRAW_ORDER_INDEX:
  63. .. _class_Particles2D_constant_DRAW_ORDER_LIFETIME:
  64. enum **DrawOrder**:
  65. - **DRAW_ORDER_INDEX** = **0** --- Particles are drawn in the order emitted.
  66. - **DRAW_ORDER_LIFETIME** = **1** --- Particles are drawn in order of remaining lifetime.
  67. Property Descriptions
  68. ---------------------
  69. .. _class_Particles2D_property_amount:
  70. - :ref:`int<class_int>` **amount**
  71. +-----------+-------------------+
  72. | *Default* | ``8`` |
  73. +-----------+-------------------+
  74. | *Setter* | set_amount(value) |
  75. +-----------+-------------------+
  76. | *Getter* | get_amount() |
  77. +-----------+-------------------+
  78. Number of particles emitted in one emission cycle.
  79. ----
  80. .. _class_Particles2D_property_draw_order:
  81. - :ref:`DrawOrder<enum_Particles2D_DrawOrder>` **draw_order**
  82. +-----------+-----------------------+
  83. | *Default* | ``0`` |
  84. +-----------+-----------------------+
  85. | *Setter* | set_draw_order(value) |
  86. +-----------+-----------------------+
  87. | *Getter* | get_draw_order() |
  88. +-----------+-----------------------+
  89. Particle draw order. Uses :ref:`DrawOrder<enum_Particles2D_DrawOrder>` values.
  90. ----
  91. .. _class_Particles2D_property_emitting:
  92. - :ref:`bool<class_bool>` **emitting**
  93. +-----------+---------------------+
  94. | *Default* | ``true`` |
  95. +-----------+---------------------+
  96. | *Setter* | set_emitting(value) |
  97. +-----------+---------------------+
  98. | *Getter* | is_emitting() |
  99. +-----------+---------------------+
  100. If ``true``, particles are being emitted.
  101. ----
  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. ----
  113. .. _class_Particles2D_property_fixed_fps:
  114. - :ref:`int<class_int>` **fixed_fps**
  115. +-----------+----------------------+
  116. | *Default* | ``0`` |
  117. +-----------+----------------------+
  118. | *Setter* | set_fixed_fps(value) |
  119. +-----------+----------------------+
  120. | *Getter* | get_fixed_fps() |
  121. +-----------+----------------------+
  122. 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.
  123. ----
  124. .. _class_Particles2D_property_fract_delta:
  125. - :ref:`bool<class_bool>` **fract_delta**
  126. +-----------+-----------------------------+
  127. | *Default* | ``true`` |
  128. +-----------+-----------------------------+
  129. | *Setter* | set_fractional_delta(value) |
  130. +-----------+-----------------------------+
  131. | *Getter* | get_fractional_delta() |
  132. +-----------+-----------------------------+
  133. If ``true``, results in fractional delta calculation which has a smoother particles display effect.
  134. ----
  135. .. _class_Particles2D_property_lifetime:
  136. - :ref:`float<class_float>` **lifetime**
  137. +-----------+---------------------+
  138. | *Default* | ``1.0`` |
  139. +-----------+---------------------+
  140. | *Setter* | set_lifetime(value) |
  141. +-----------+---------------------+
  142. | *Getter* | get_lifetime() |
  143. +-----------+---------------------+
  144. Amount of time each particle will exist.
  145. ----
  146. .. _class_Particles2D_property_local_coords:
  147. - :ref:`bool<class_bool>` **local_coords**
  148. +-----------+----------------------------------+
  149. | *Default* | ``true`` |
  150. +-----------+----------------------------------+
  151. | *Setter* | set_use_local_coordinates(value) |
  152. +-----------+----------------------------------+
  153. | *Getter* | get_use_local_coordinates() |
  154. +-----------+----------------------------------+
  155. If ``true``, particles use the parent node's coordinate space. If ``false``, they use global coordinates.
  156. ----
  157. .. _class_Particles2D_property_normal_map:
  158. - :ref:`Texture<class_Texture>` **normal_map**
  159. +----------+-----------------------+
  160. | *Setter* | set_normal_map(value) |
  161. +----------+-----------------------+
  162. | *Getter* | get_normal_map() |
  163. +----------+-----------------------+
  164. Normal map to be used for the :ref:`texture<class_Particles2D_property_texture>` property.
  165. **Note:** Godot expects the normal map to use X+, Y-, and Z+ coordinates. See `this page <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates>`_ for a comparison of normal map coordinates expected by popular engines.
  166. ----
  167. .. _class_Particles2D_property_one_shot:
  168. - :ref:`bool<class_bool>` **one_shot**
  169. +-----------+---------------------+
  170. | *Default* | ``false`` |
  171. +-----------+---------------------+
  172. | *Setter* | set_one_shot(value) |
  173. +-----------+---------------------+
  174. | *Getter* | get_one_shot() |
  175. +-----------+---------------------+
  176. If ``true``, only one emission cycle occurs. If set ``true`` during a cycle, emission will stop at the cycle's end.
  177. ----
  178. .. _class_Particles2D_property_preprocess:
  179. - :ref:`float<class_float>` **preprocess**
  180. +-----------+-----------------------------+
  181. | *Default* | ``0.0`` |
  182. +-----------+-----------------------------+
  183. | *Setter* | set_pre_process_time(value) |
  184. +-----------+-----------------------------+
  185. | *Getter* | get_pre_process_time() |
  186. +-----------+-----------------------------+
  187. Particle system starts as if it had already run for this many seconds.
  188. ----
  189. .. _class_Particles2D_property_process_material:
  190. - :ref:`Material<class_Material>` **process_material**
  191. +----------+-----------------------------+
  192. | *Setter* | set_process_material(value) |
  193. +----------+-----------------------------+
  194. | *Getter* | get_process_material() |
  195. +----------+-----------------------------+
  196. :ref:`Material<class_Material>` for processing particles. Can be a :ref:`ParticlesMaterial<class_ParticlesMaterial>` or a :ref:`ShaderMaterial<class_ShaderMaterial>`.
  197. ----
  198. .. _class_Particles2D_property_randomness:
  199. - :ref:`float<class_float>` **randomness**
  200. +-----------+-----------------------------+
  201. | *Default* | ``0.0`` |
  202. +-----------+-----------------------------+
  203. | *Setter* | set_randomness_ratio(value) |
  204. +-----------+-----------------------------+
  205. | *Getter* | get_randomness_ratio() |
  206. +-----------+-----------------------------+
  207. Emission lifetime randomness ratio.
  208. ----
  209. .. _class_Particles2D_property_speed_scale:
  210. - :ref:`float<class_float>` **speed_scale**
  211. +-----------+------------------------+
  212. | *Default* | ``1.0`` |
  213. +-----------+------------------------+
  214. | *Setter* | set_speed_scale(value) |
  215. +-----------+------------------------+
  216. | *Getter* | get_speed_scale() |
  217. +-----------+------------------------+
  218. Particle system's running speed scaling ratio. A value of ``0`` can be used to pause the particles.
  219. ----
  220. .. _class_Particles2D_property_texture:
  221. - :ref:`Texture<class_Texture>` **texture**
  222. +----------+--------------------+
  223. | *Setter* | set_texture(value) |
  224. +----------+--------------------+
  225. | *Getter* | get_texture() |
  226. +----------+--------------------+
  227. Particle texture. If ``null``, particles will be squares.
  228. ----
  229. .. _class_Particles2D_property_visibility_rect:
  230. - :ref:`Rect2<class_Rect2>` **visibility_rect**
  231. +-----------+-----------------------------------+
  232. | *Default* | ``Rect2( -100, -100, 200, 200 )`` |
  233. +-----------+-----------------------------------+
  234. | *Setter* | set_visibility_rect(value) |
  235. +-----------+-----------------------------------+
  236. | *Getter* | get_visibility_rect() |
  237. +-----------+-----------------------------------+
  238. Editor visibility helper.
  239. Method Descriptions
  240. -------------------
  241. .. _class_Particles2D_method_capture_rect:
  242. - :ref:`Rect2<class_Rect2>` **capture_rect** **(** **)** |const|
  243. Returns a rectangle containing the positions of all existing particles.
  244. ----
  245. .. _class_Particles2D_method_restart:
  246. - void **restart** **(** **)**
  247. Restarts all the existing particles.
  248. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  249. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  250. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`