AnimatedSprite2D.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimatedSprite2D" inherits="Node2D" version="4.0">
  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. [b]Note:[/b] You can associate a set of normal or specular maps by creating additional [SpriteFrames] resources with a [code]_normal[/code] or [code]_specular[/code] suffix. For example, having 3 [SpriteFrames] resources [code]run[/code], [code]run_normal[/code], and [code]run_specular[/code] will make it so the [code]run[/code] animation uses normal and specular maps.
  9. </description>
  10. <tutorials>
  11. <link title="2D Sprite animation">https://docs.godotengine.org/en/latest/tutorials/2d/2d_sprite_animation.html</link>
  12. <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
  13. </tutorials>
  14. <methods>
  15. <method name="is_playing" qualifiers="const">
  16. <return type="bool" />
  17. <description>
  18. Returns [code]true[/code] if an animation is currently being played.
  19. </description>
  20. </method>
  21. <method name="play">
  22. <return type="void" />
  23. <argument index="0" name="anim" type="StringName" default="&amp;&quot;&quot;" />
  24. <argument index="1" name="backwards" type="bool" default="false" />
  25. <description>
  26. Plays the animation named [code]anim[/code]. If no [code]anim[/code] is provided, the current animation is played. If [code]backwards[/code] is [code]true[/code], the animation will be played in reverse.
  27. </description>
  28. </method>
  29. <method name="stop">
  30. <return type="void" />
  31. <description>
  32. Stops the current animation (does not reset the frame counter).
  33. </description>
  34. </method>
  35. </methods>
  36. <members>
  37. <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&amp;&quot;default&quot;">
  38. The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
  39. </member>
  40. <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
  41. If [code]true[/code], texture will be centered.
  42. </member>
  43. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
  44. If [code]true[/code], texture is flipped horizontally.
  45. </member>
  46. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
  47. If [code]true[/code], texture is flipped vertically.
  48. </member>
  49. <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
  50. The displayed animation frame's index.
  51. </member>
  52. <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
  53. The [SpriteFrames] resource containing the animation(s).
  54. </member>
  55. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
  56. The texture's drawing offset.
  57. </member>
  58. <member name="playing" type="bool" setter="_set_playing" getter="_is_playing" default="false">
  59. If [code]true[/code], the [member animation] is currently playing.
  60. </member>
  61. <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
  62. The animation speed is multiplied by this value.
  63. </member>
  64. </members>
  65. <signals>
  66. <signal name="animation_finished">
  67. <description>
  68. 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.
  69. </description>
  70. </signal>
  71. <signal name="frame_changed">
  72. <description>
  73. Emitted when [member frame] changed.
  74. </description>
  75. </signal>
  76. </signals>
  77. </class>