AnimatedSprite.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimatedSprite" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. Sprite node that can use multiple textures for animation.
  5. </brief_description>
  6. <description>
  7. Animations are created using a [SpriteFrames] resource, which can be configured in the editor via the SpriteFrames panel.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="get_animation" qualifiers="const">
  15. <return type="String">
  16. </return>
  17. <description>
  18. Return the name of the current animation set to the node.
  19. </description>
  20. </method>
  21. <method name="get_frame" qualifiers="const">
  22. <return type="int">
  23. </return>
  24. <description>
  25. Return the visible frame index.
  26. </description>
  27. </method>
  28. <method name="get_offset" qualifiers="const">
  29. <return type="Vector2">
  30. </return>
  31. <description>
  32. Return the offset of the sprite in the node origin.
  33. </description>
  34. </method>
  35. <method name="get_sprite_frames" qualifiers="const">
  36. <return type="SpriteFrames">
  37. </return>
  38. <description>
  39. Get the [SpriteFrames] resource, which contains all frames.
  40. </description>
  41. </method>
  42. <method name="is_centered" qualifiers="const">
  43. <return type="bool">
  44. </return>
  45. <description>
  46. Return true when centered. See [method set_centered].
  47. </description>
  48. </method>
  49. <method name="is_flipped_h" qualifiers="const">
  50. <return type="bool">
  51. </return>
  52. <description>
  53. Return true if sprite is flipped horizontally.
  54. </description>
  55. </method>
  56. <method name="is_flipped_v" qualifiers="const">
  57. <return type="bool">
  58. </return>
  59. <description>
  60. Return true if sprite is flipped vertically.
  61. </description>
  62. </method>
  63. <method name="is_playing" qualifiers="const">
  64. <return type="bool">
  65. </return>
  66. <description>
  67. Return true if an animation if currently being played.
  68. </description>
  69. </method>
  70. <method name="play">
  71. <return type="void">
  72. </return>
  73. <argument index="0" name="anim" type="String" default="&quot;&quot;">
  74. </argument>
  75. <description>
  76. Play the animation set in parameter. If no parameter is provided, the current animation is played.
  77. </description>
  78. </method>
  79. <method name="set_animation">
  80. <return type="void">
  81. </return>
  82. <argument index="0" name="animation" type="String">
  83. </argument>
  84. <description>
  85. Set the current animation of the node and reinits the frame counter of the animation.
  86. </description>
  87. </method>
  88. <method name="set_centered">
  89. <return type="void">
  90. </return>
  91. <argument index="0" name="centered" type="bool">
  92. </argument>
  93. <description>
  94. When turned on, offset at (0,0) is the center of the sprite, when off, the top-left corner is.
  95. </description>
  96. </method>
  97. <method name="set_flip_h">
  98. <return type="void">
  99. </return>
  100. <argument index="0" name="flip_h" type="bool">
  101. </argument>
  102. <description>
  103. If true, sprite is flipped horizontally.
  104. </description>
  105. </method>
  106. <method name="set_flip_v">
  107. <return type="void">
  108. </return>
  109. <argument index="0" name="flip_v" type="bool">
  110. </argument>
  111. <description>
  112. If true, sprite is flipped vertically.
  113. </description>
  114. </method>
  115. <method name="set_frame">
  116. <return type="void">
  117. </return>
  118. <argument index="0" name="frame" type="int">
  119. </argument>
  120. <description>
  121. Set the visible sprite frame index (from the list of frames inside the [SpriteFrames] resource).
  122. </description>
  123. </method>
  124. <method name="set_offset">
  125. <return type="void">
  126. </return>
  127. <argument index="0" name="offset" type="Vector2">
  128. </argument>
  129. <description>
  130. Set the offset of the sprite in the node origin. Position varies depending on whether it is centered or not.
  131. </description>
  132. </method>
  133. <method name="set_sprite_frames">
  134. <return type="void">
  135. </return>
  136. <argument index="0" name="sprite_frames" type="SpriteFrames">
  137. </argument>
  138. <description>
  139. Set the [SpriteFrames] resource, which contains all frames.
  140. </description>
  141. </method>
  142. <method name="stop">
  143. <return type="void">
  144. </return>
  145. <description>
  146. Stop the current animation (does not reset the frame counter).
  147. </description>
  148. </method>
  149. </methods>
  150. <members>
  151. <member name="animation" type="String" setter="set_animation" getter="get_animation">
  152. The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
  153. </member>
  154. <member name="centered" type="bool" setter="set_centered" getter="is_centered">
  155. If [code]true[/code] texture will be centered. Default value: [code]true[/code].
  156. </member>
  157. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h">
  158. If [code]true[/code] texture is flipped horizontally. Default value: [code]false[/code].
  159. </member>
  160. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v">
  161. If [code]true[/code] texture is flipped vertically. Default value: [code]false[/code].
  162. </member>
  163. <member name="frame" type="int" setter="set_frame" getter="get_frame">
  164. The displayed animation frame's index.
  165. </member>
  166. <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
  167. The [SpriteFrames] resource containing the animation(s).
  168. </member>
  169. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset">
  170. The texture's drawing offset.
  171. </member>
  172. <member name="playing" type="bool" setter="_set_playing" getter="_is_playing">
  173. If [code]true[/code] the [member animation] is currently playing.
  174. </member>
  175. </members>
  176. <signals>
  177. <signal name="animation_finished">
  178. <description>
  179. Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn.
  180. </description>
  181. </signal>
  182. <signal name="frame_changed">
  183. <description>
  184. Emitted when [member frame] changed.
  185. </description>
  186. </signal>
  187. </signals>
  188. <constants>
  189. </constants>
  190. </class>