class_particles2d.rst 12 KB

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