class_particles2d.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. Member Functions
  13. ----------------
  14. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Rect2<class_rect2>` | :ref:`capture_rect<class_Particles2D_capture_rect>` **(** **)** const |
  16. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`get_amount<class_Particles2D_get_amount>` **(** **)** const |
  18. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`get_draw_order<class_Particles2D_get_draw_order>` **(** **)** const |
  20. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_explosiveness_ratio<class_Particles2D_get_explosiveness_ratio>` **(** **)** const |
  22. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_fixed_fps<class_Particles2D_get_fixed_fps>` **(** **)** const |
  24. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`get_fractional_delta<class_Particles2D_get_fractional_delta>` **(** **)** const |
  26. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_h_frames<class_Particles2D_get_h_frames>` **(** **)** const |
  28. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`get_lifetime<class_Particles2D_get_lifetime>` **(** **)** const |
  30. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Texture<class_texture>` | :ref:`get_normal_map<class_Particles2D_get_normal_map>` **(** **)** const |
  32. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`get_one_shot<class_Particles2D_get_one_shot>` **(** **)** const |
  34. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`get_pre_process_time<class_Particles2D_get_pre_process_time>` **(** **)** const |
  36. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Material<class_material>` | :ref:`get_process_material<class_Particles2D_get_process_material>` **(** **)** const |
  38. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`float<class_float>` | :ref:`get_randomness_ratio<class_Particles2D_get_randomness_ratio>` **(** **)** const |
  40. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`float<class_float>` | :ref:`get_speed_scale<class_Particles2D_get_speed_scale>` **(** **)** const |
  42. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Texture<class_texture>` | :ref:`get_texture<class_Particles2D_get_texture>` **(** **)** const |
  44. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`get_use_local_coordinates<class_Particles2D_get_use_local_coordinates>` **(** **)** const |
  46. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_v_frames<class_Particles2D_get_v_frames>` **(** **)** const |
  48. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Rect2<class_rect2>` | :ref:`get_visibility_rect<class_Particles2D_get_visibility_rect>` **(** **)** const |
  50. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`is_emitting<class_Particles2D_is_emitting>` **(** **)** const |
  52. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`restart<class_Particles2D_restart>` **(** **)** |
  54. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`set_amount<class_Particles2D_set_amount>` **(** :ref:`int<class_int>` amount **)** |
  56. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`set_draw_order<class_Particles2D_set_draw_order>` **(** :ref:`int<class_int>` order **)** |
  58. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`set_emitting<class_Particles2D_set_emitting>` **(** :ref:`bool<class_bool>` emitting **)** |
  60. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`set_explosiveness_ratio<class_Particles2D_set_explosiveness_ratio>` **(** :ref:`float<class_float>` ratio **)** |
  62. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_fixed_fps<class_Particles2D_set_fixed_fps>` **(** :ref:`int<class_int>` fps **)** |
  64. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_fractional_delta<class_Particles2D_set_fractional_delta>` **(** :ref:`bool<class_bool>` enable **)** |
  66. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_h_frames<class_Particles2D_set_h_frames>` **(** :ref:`int<class_int>` frames **)** |
  68. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`set_lifetime<class_Particles2D_set_lifetime>` **(** :ref:`float<class_float>` secs **)** |
  70. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_normal_map<class_Particles2D_set_normal_map>` **(** :ref:`Texture<class_texture>` texture **)** |
  72. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`set_one_shot<class_Particles2D_set_one_shot>` **(** :ref:`bool<class_bool>` secs **)** |
  74. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_pre_process_time<class_Particles2D_set_pre_process_time>` **(** :ref:`float<class_float>` secs **)** |
  76. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_process_material<class_Particles2D_set_process_material>` **(** :ref:`Material<class_material>` material **)** |
  78. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_randomness_ratio<class_Particles2D_set_randomness_ratio>` **(** :ref:`float<class_float>` ratio **)** |
  80. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`set_speed_scale<class_Particles2D_set_speed_scale>` **(** :ref:`float<class_float>` scale **)** |
  82. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_texture<class_Particles2D_set_texture>` **(** :ref:`Texture<class_texture>` texture **)** |
  84. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`set_use_local_coordinates<class_Particles2D_set_use_local_coordinates>` **(** :ref:`bool<class_bool>` enable **)** |
  86. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`set_v_frames<class_Particles2D_set_v_frames>` **(** :ref:`int<class_int>` frames **)** |
  88. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`set_visibility_rect<class_Particles2D_set_visibility_rect>` **(** :ref:`Rect2<class_rect2>` aabb **)** |
  90. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  91. Member Variables
  92. ----------------
  93. - :ref:`int<class_int>` **amount** - Number of particles to emit.
  94. - :ref:`int<class_int>` **draw_order** - Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code].
  95. - :ref:`bool<class_bool>` **emitting** - If [code]true[/code] particles are being emitted. Default value: [code]true[/code].
  96. - :ref:`float<class_float>` **explosiveness** - Time ratio between each emission. If [code]0[/code] particles are emitted continuously. If [code]1[/code] all particles are emitted simultaneously. Default value: [code]0[/code].
  97. - :ref:`int<class_int>` **fixed_fps**
  98. - :ref:`bool<class_bool>` **fract_delta**
  99. - :ref:`int<class_int>` **h_frames** - Number of horizontal frames in [code]texture[/code].
  100. - :ref:`float<class_float>` **lifetime** - Amount of time each particle will exist. Default value: [code]1[/code].
  101. - :ref:`bool<class_bool>` **local_coords** - If [code]true[/code] particles use the parent node's coordinate space. If [code]false[/code] they use global coordinates. Default value: [code]true[/code].
  102. - :ref:`Texture<class_texture>` **normal_map**
  103. - :ref:`bool<class_bool>` **one_shot** - If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code].
  104. - :ref:`float<class_float>` **preprocess**
  105. - :ref:`Material<class_material>` **process_material** - [Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial].
  106. - :ref:`float<class_float>` **randomness** - Emission randomness ratio. Default value: [code]0[/code].
  107. - :ref:`float<class_float>` **speed_scale** - Speed scaling ratio. Default value: [code]1[/code].
  108. - :ref:`Texture<class_texture>` **texture** - Particle texture. If [code]null[/code] particles will be squares.
  109. - :ref:`int<class_int>` **v_frames** - Number of vertical frames in [code]texture[/code].
  110. - :ref:`Rect2<class_rect2>` **visibility_rect**
  111. Numeric Constants
  112. -----------------
  113. - **DRAW_ORDER_INDEX** = **0** --- Particles are drawn in the order emitted.
  114. - **DRAW_ORDER_LIFETIME** = **1** --- Particles are drawn in order of remaining lifetime.
  115. Description
  116. -----------
  117. 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.
  118. 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.
  119. Member Function Description
  120. ---------------------------
  121. .. _class_Particles2D_capture_rect:
  122. - :ref:`Rect2<class_rect2>` **capture_rect** **(** **)** const
  123. .. _class_Particles2D_get_amount:
  124. - :ref:`int<class_int>` **get_amount** **(** **)** const
  125. Returns the amount of particles spawned at each emission
  126. .. _class_Particles2D_get_draw_order:
  127. - :ref:`int<class_int>` **get_draw_order** **(** **)** const
  128. .. _class_Particles2D_get_explosiveness_ratio:
  129. - :ref:`float<class_float>` **get_explosiveness_ratio** **(** **)** const
  130. .. _class_Particles2D_get_fixed_fps:
  131. - :ref:`int<class_int>` **get_fixed_fps** **(** **)** const
  132. .. _class_Particles2D_get_fractional_delta:
  133. - :ref:`bool<class_bool>` **get_fractional_delta** **(** **)** const
  134. .. _class_Particles2D_get_h_frames:
  135. - :ref:`int<class_int>` **get_h_frames** **(** **)** const
  136. .. _class_Particles2D_get_lifetime:
  137. - :ref:`float<class_float>` **get_lifetime** **(** **)** const
  138. Gets the amount of seconds that each particle will be visible.
  139. .. _class_Particles2D_get_normal_map:
  140. - :ref:`Texture<class_texture>` **get_normal_map** **(** **)** const
  141. .. _class_Particles2D_get_one_shot:
  142. - :ref:`bool<class_bool>` **get_one_shot** **(** **)** const
  143. .. _class_Particles2D_get_pre_process_time:
  144. - :ref:`float<class_float>` **get_pre_process_time** **(** **)** const
  145. .. _class_Particles2D_get_process_material:
  146. - :ref:`Material<class_material>` **get_process_material** **(** **)** const
  147. .. _class_Particles2D_get_randomness_ratio:
  148. - :ref:`float<class_float>` **get_randomness_ratio** **(** **)** const
  149. .. _class_Particles2D_get_speed_scale:
  150. - :ref:`float<class_float>` **get_speed_scale** **(** **)** const
  151. .. _class_Particles2D_get_texture:
  152. - :ref:`Texture<class_texture>` **get_texture** **(** **)** const
  153. Returns the texture for emitted particles
  154. .. _class_Particles2D_get_use_local_coordinates:
  155. - :ref:`bool<class_bool>` **get_use_local_coordinates** **(** **)** const
  156. .. _class_Particles2D_get_v_frames:
  157. - :ref:`int<class_int>` **get_v_frames** **(** **)** const
  158. .. _class_Particles2D_get_visibility_rect:
  159. - :ref:`Rect2<class_rect2>` **get_visibility_rect** **(** **)** const
  160. .. _class_Particles2D_is_emitting:
  161. - :ref:`bool<class_bool>` **is_emitting** **(** **)** const
  162. Returns whether this emitter is currently emitting or not
  163. .. _class_Particles2D_restart:
  164. - void **restart** **(** **)**
  165. .. _class_Particles2D_set_amount:
  166. - void **set_amount** **(** :ref:`int<class_int>` amount **)**
  167. Sets the amount of particles spawned at each emission
  168. .. _class_Particles2D_set_draw_order:
  169. - void **set_draw_order** **(** :ref:`int<class_int>` order **)**
  170. .. _class_Particles2D_set_emitting:
  171. - void **set_emitting** **(** :ref:`bool<class_bool>` emitting **)**
  172. If this is set to true then the particle emitter will emit particles, if its false it will not.
  173. .. _class_Particles2D_set_explosiveness_ratio:
  174. - void **set_explosiveness_ratio** **(** :ref:`float<class_float>` ratio **)**
  175. .. _class_Particles2D_set_fixed_fps:
  176. - void **set_fixed_fps** **(** :ref:`int<class_int>` fps **)**
  177. .. _class_Particles2D_set_fractional_delta:
  178. - void **set_fractional_delta** **(** :ref:`bool<class_bool>` enable **)**
  179. .. _class_Particles2D_set_h_frames:
  180. - void **set_h_frames** **(** :ref:`int<class_int>` frames **)**
  181. .. _class_Particles2D_set_lifetime:
  182. - void **set_lifetime** **(** :ref:`float<class_float>` secs **)**
  183. Sets the amount of seconds that each particle will be visible.
  184. .. _class_Particles2D_set_normal_map:
  185. - void **set_normal_map** **(** :ref:`Texture<class_texture>` texture **)**
  186. .. _class_Particles2D_set_one_shot:
  187. - void **set_one_shot** **(** :ref:`bool<class_bool>` secs **)**
  188. .. _class_Particles2D_set_pre_process_time:
  189. - void **set_pre_process_time** **(** :ref:`float<class_float>` secs **)**
  190. .. _class_Particles2D_set_process_material:
  191. - void **set_process_material** **(** :ref:`Material<class_material>` material **)**
  192. .. _class_Particles2D_set_randomness_ratio:
  193. - void **set_randomness_ratio** **(** :ref:`float<class_float>` ratio **)**
  194. .. _class_Particles2D_set_speed_scale:
  195. - void **set_speed_scale** **(** :ref:`float<class_float>` scale **)**
  196. .. _class_Particles2D_set_texture:
  197. - void **set_texture** **(** :ref:`Texture<class_texture>` texture **)**
  198. .. _class_Particles2D_set_use_local_coordinates:
  199. - void **set_use_local_coordinates** **(** :ref:`bool<class_bool>` enable **)**
  200. .. _class_Particles2D_set_v_frames:
  201. - void **set_v_frames** **(** :ref:`int<class_int>` frames **)**
  202. .. _class_Particles2D_set_visibility_rect:
  203. - void **set_visibility_rect** **(** :ref:`Rect2<class_rect2>` aabb **)**