AnimatedSprite.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimatedSprite" inherits="Node2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Sprite node that contains multiple textures as frames to play for animation.
  5. </brief_description>
  6. <description>
  7. [AnimatedSprite] is similar to the [Sprite] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
  8. [b]Note:[/b] You can associate a set of normal maps by creating additional animations with a [code]_normal[/code] suffix. For example, having 2 animations [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">$DOCS_URL/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="play">
  16. <return type="void" />
  17. <argument index="0" name="anim" type="String" default="&quot;&quot;" />
  18. <argument index="1" name="backwards" type="bool" default="false" />
  19. <description>
  20. 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.
  21. </description>
  22. </method>
  23. <method name="stop">
  24. <return type="void" />
  25. <description>
  26. Stops the current animation (does not reset the frame counter).
  27. </description>
  28. </method>
  29. </methods>
  30. <members>
  31. <member name="animation" type="String" setter="set_animation" getter="get_animation" default="&quot;default&quot;">
  32. The current animation from the [member frames] resource. If this value changes, the [code]frame[/code] counter is reset.
  33. </member>
  34. <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
  35. If [code]true[/code], texture will be centered.
  36. </member>
  37. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
  38. If [code]true[/code], texture is flipped horizontally.
  39. </member>
  40. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
  41. If [code]true[/code], texture is flipped vertically.
  42. </member>
  43. <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
  44. The displayed animation frame's index.
  45. </member>
  46. <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
  47. The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource.
  48. </member>
  49. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )">
  50. The texture's drawing offset.
  51. </member>
  52. <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false">
  53. If [code]true[/code], the [member animation] is currently playing.
  54. </member>
  55. <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
  56. The animation speed is multiplied by this value.
  57. </member>
  58. </members>
  59. <signals>
  60. <signal name="animation_finished">
  61. <description>
  62. 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.
  63. </description>
  64. </signal>
  65. <signal name="frame_changed">
  66. <description>
  67. Emitted when [member frame] changed.
  68. </description>
  69. </signal>
  70. </signals>
  71. <constants>
  72. </constants>
  73. </class>