AnimatedSprite.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimatedSprite" inherits="Node2D" version="3.4">
  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 maps by creating additional [SpriteFrames] resources with a [code]_normal[/code] suffix. For example, having 2 [SpriteFrames] resources [code]run[/code] and [code]run_normal[/code] will make it so the [code]run[/code] animation uses the normal map.
  9. </description>
  10. <tutorials>
  11. <link title="2D Sprite animation">https://docs.godotengine.org/en/3.3/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. </return>
  18. <description>
  19. Returns [code]true[/code] if an animation is currently being played.
  20. </description>
  21. </method>
  22. <method name="play">
  23. <return type="void">
  24. </return>
  25. <argument index="0" name="anim" type="String" default="&quot;&quot;">
  26. </argument>
  27. <argument index="1" name="backwards" type="bool" default="false">
  28. </argument>
  29. <description>
  30. 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.
  31. </description>
  32. </method>
  33. <method name="stop">
  34. <return type="void">
  35. </return>
  36. <description>
  37. Stops the current animation (does not reset the frame counter).
  38. </description>
  39. </method>
  40. </methods>
  41. <members>
  42. <member name="animation" type="String" setter="set_animation" getter="get_animation" default="&quot;default&quot;">
  43. The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
  44. </member>
  45. <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
  46. If [code]true[/code], texture will be centered.
  47. </member>
  48. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
  49. If [code]true[/code], texture is flipped horizontally.
  50. </member>
  51. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
  52. If [code]true[/code], texture is flipped vertically.
  53. </member>
  54. <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
  55. The displayed animation frame's index.
  56. </member>
  57. <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
  58. The [SpriteFrames] resource containing the animation(s).
  59. </member>
  60. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )">
  61. The texture's drawing offset.
  62. </member>
  63. <member name="playing" type="bool" setter="_set_playing" getter="_is_playing" default="false">
  64. If [code]true[/code], the [member animation] is currently playing.
  65. </member>
  66. <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
  67. The animation speed is multiplied by this value.
  68. </member>
  69. </members>
  70. <signals>
  71. <signal name="animation_finished">
  72. <description>
  73. 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.
  74. </description>
  75. </signal>
  76. <signal name="frame_changed">
  77. <description>
  78. Emitted when [member frame] changed.
  79. </description>
  80. </signal>
  81. </signals>
  82. <constants>
  83. </constants>
  84. </class>