AnimatedSprite2D.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. </description>
  9. <tutorials>
  10. <link title="2D Sprite animation">https://docs.godotengine.org/en/latest/tutorials/2d/2d_sprite_animation.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="is_playing" qualifiers="const">
  14. <return type="bool">
  15. </return>
  16. <description>
  17. Returns [code]true[/code] if an animation is currently being played.
  18. </description>
  19. </method>
  20. <method name="play">
  21. <return type="void">
  22. </return>
  23. <argument index="0" name="anim" type="StringName" default="@&quot;&quot;">
  24. </argument>
  25. <argument index="1" name="backwards" type="bool" default="false">
  26. </argument>
  27. <description>
  28. 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.
  29. </description>
  30. </method>
  31. <method name="stop">
  32. <return type="void">
  33. </return>
  34. <description>
  35. Stops the current animation (does not reset the frame counter).
  36. </description>
  37. </method>
  38. </methods>
  39. <members>
  40. <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="@&quot;default&quot;">
  41. The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset.
  42. </member>
  43. <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true">
  44. If [code]true[/code], texture will be centered.
  45. </member>
  46. <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false">
  47. If [code]true[/code], texture is flipped horizontally.
  48. </member>
  49. <member name="flip_v" type="bool" setter="set_flip_v" getter="is_flipped_v" default="false">
  50. If [code]true[/code], texture is flipped vertically.
  51. </member>
  52. <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0">
  53. The displayed animation frame's index.
  54. </member>
  55. <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames">
  56. The [SpriteFrames] resource containing the animation(s).
  57. </member>
  58. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )">
  59. The texture's drawing offset.
  60. </member>
  61. <member name="playing" type="bool" setter="_set_playing" getter="_is_playing" default="false">
  62. If [code]true[/code], the [member animation] is currently playing.
  63. </member>
  64. <member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0">
  65. Strength of the specular light effect of this [AnimatedSprite2D].
  66. </member>
  67. <member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )">
  68. The color of the specular light effect.
  69. </member>
  70. <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
  71. The animation speed is multiplied by this value.
  72. </member>
  73. </members>
  74. <signals>
  75. <signal name="animation_finished">
  76. <description>
  77. 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.
  78. </description>
  79. </signal>
  80. <signal name="frame_changed">
  81. <description>
  82. Emitted when [member frame] changed.
  83. </description>
  84. </signal>
  85. </signals>
  86. <constants>
  87. </constants>
  88. </class>