class_animatedsprite.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_AnimatedSprite:
  4. AnimatedSprite
  5. ==============
  6. **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Sprite node that can use multiple textures for animation.
  11. Member Functions
  12. ----------------
  13. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`String<class_string>` | :ref:`get_animation<class_AnimatedSprite_get_animation>` **(** **)** const |
  15. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`get_frame<class_AnimatedSprite_get_frame>` **(** **)** const |
  17. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_AnimatedSprite_get_offset>` **(** **)** const |
  19. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`SpriteFrames<class_spriteframes>` | :ref:`get_sprite_frames<class_AnimatedSprite_get_sprite_frames>` **(** **)** const |
  21. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`is_centered<class_AnimatedSprite_is_centered>` **(** **)** const |
  23. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_flipped_h<class_AnimatedSprite_is_flipped_h>` **(** **)** const |
  25. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_flipped_v<class_AnimatedSprite_is_flipped_v>` **(** **)** const |
  27. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite_is_playing>` **(** **)** const |
  29. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`play<class_AnimatedSprite_play>` **(** :ref:`String<class_string>` anim="" **)** |
  31. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_animation<class_AnimatedSprite_set_animation>` **(** :ref:`String<class_string>` animation **)** |
  33. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_centered<class_AnimatedSprite_set_centered>` **(** :ref:`bool<class_bool>` centered **)** |
  35. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`set_flip_h<class_AnimatedSprite_set_flip_h>` **(** :ref:`bool<class_bool>` flip_h **)** |
  37. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_flip_v<class_AnimatedSprite_set_flip_v>` **(** :ref:`bool<class_bool>` flip_v **)** |
  39. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_frame<class_AnimatedSprite_set_frame>` **(** :ref:`int<class_int>` frame **)** |
  41. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_offset<class_AnimatedSprite_set_offset>` **(** :ref:`Vector2<class_vector2>` offset **)** |
  43. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_sprite_frames<class_AnimatedSprite_set_sprite_frames>` **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)** |
  45. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`stop<class_AnimatedSprite_stop>` **(** **)** |
  47. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  48. Signals
  49. -------
  50. - **animation_finished** **(** **)**
  51. - **frame_changed** **(** **)**
  52. Member Variables
  53. ----------------
  54. - :ref:`String<class_string>` **animation**
  55. - :ref:`bool<class_bool>` **centered**
  56. - :ref:`bool<class_bool>` **flip_h**
  57. - :ref:`bool<class_bool>` **flip_v**
  58. - :ref:`int<class_int>` **frame**
  59. - :ref:`SpriteFrames<class_spriteframes>` **frames**
  60. - :ref:`Vector2<class_vector2>` **offset**
  61. - :ref:`bool<class_bool>` **playing**
  62. Description
  63. -----------
  64. Sprite node that can use multiple textures for animation.
  65. Member Function Description
  66. ---------------------------
  67. .. _class_AnimatedSprite_get_animation:
  68. - :ref:`String<class_string>` **get_animation** **(** **)** const
  69. Return the name of the current animation set to the node.
  70. .. _class_AnimatedSprite_get_frame:
  71. - :ref:`int<class_int>` **get_frame** **(** **)** const
  72. Return the visible frame index.
  73. .. _class_AnimatedSprite_get_offset:
  74. - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
  75. Return the offset of the sprite in the node origin.
  76. .. _class_AnimatedSprite_get_sprite_frames:
  77. - :ref:`SpriteFrames<class_spriteframes>` **get_sprite_frames** **(** **)** const
  78. Get the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  79. .. _class_AnimatedSprite_is_centered:
  80. - :ref:`bool<class_bool>` **is_centered** **(** **)** const
  81. Return true when centered. See :ref:`set_centered<class_AnimatedSprite_set_centered>`.
  82. .. _class_AnimatedSprite_is_flipped_h:
  83. - :ref:`bool<class_bool>` **is_flipped_h** **(** **)** const
  84. Return true if sprite is flipped horizontally.
  85. .. _class_AnimatedSprite_is_flipped_v:
  86. - :ref:`bool<class_bool>` **is_flipped_v** **(** **)** const
  87. Return true if sprite is flipped vertically.
  88. .. _class_AnimatedSprite_is_playing:
  89. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  90. Return true if an animation if currently being played.
  91. .. _class_AnimatedSprite_play:
  92. - void **play** **(** :ref:`String<class_string>` anim="" **)**
  93. Play the animation set in parameter. If no parameter is provided, the current animation is played.
  94. .. _class_AnimatedSprite_set_animation:
  95. - void **set_animation** **(** :ref:`String<class_string>` animation **)**
  96. Set the current animation of the node and reinits the frame counter of the animation.
  97. .. _class_AnimatedSprite_set_centered:
  98. - void **set_centered** **(** :ref:`bool<class_bool>` centered **)**
  99. When turned on, offset at (0,0) is the center of the sprite, when off, the top-left corner is.
  100. .. _class_AnimatedSprite_set_flip_h:
  101. - void **set_flip_h** **(** :ref:`bool<class_bool>` flip_h **)**
  102. If true, sprite is flipped horizontally.
  103. .. _class_AnimatedSprite_set_flip_v:
  104. - void **set_flip_v** **(** :ref:`bool<class_bool>` flip_v **)**
  105. If true, sprite is flipped vertically.
  106. .. _class_AnimatedSprite_set_frame:
  107. - void **set_frame** **(** :ref:`int<class_int>` frame **)**
  108. Set the visible sprite frame index (from the list of frames inside the :ref:`SpriteFrames<class_spriteframes>` resource).
  109. .. _class_AnimatedSprite_set_offset:
  110. - void **set_offset** **(** :ref:`Vector2<class_vector2>` offset **)**
  111. Set the offset of the sprite in the node origin. Position varies depending on whether it is centered or not.
  112. .. _class_AnimatedSprite_set_sprite_frames:
  113. - void **set_sprite_frames** **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)**
  114. Set the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  115. .. _class_AnimatedSprite_stop:
  116. - void **stop** **(** **)**
  117. Stop the current animation (does not reset the frame counter).