class_animatedsprite.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. .. _class_AnimatedSprite:
  2. AnimatedSprite
  3. ==============
  4. **Inherits:** :ref:`Node2D<class_node2d>`
  5. **Category:** Core
  6. Sprite node that can use multiple textures for animation.
  7. Member Functions
  8. ----------------
  9. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  10. | void | :ref:`set_sprite_frames<class_AnimatedSprite_set_sprite_frames>` **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)** |
  11. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  12. | :ref:`SpriteFrames<class_spriteframes>` | :ref:`get_sprite_frames<class_AnimatedSprite_get_sprite_frames>` **(** **)** const |
  13. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`set_centered<class_AnimatedSprite_set_centered>` **(** :ref:`bool<class_bool>` centered **)** |
  15. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`is_centered<class_AnimatedSprite_is_centered>` **(** **)** const |
  17. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`set_offset<class_AnimatedSprite_set_offset>` **(** :ref:`Vector2<class_vector2>` offset **)** |
  19. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_AnimatedSprite_get_offset>` **(** **)** const |
  21. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`set_flip_h<class_AnimatedSprite_set_flip_h>` **(** :ref:`bool<class_bool>` flip_h **)** |
  23. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_flipped_h<class_AnimatedSprite_is_flipped_h>` **(** **)** const |
  25. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_flip_v<class_AnimatedSprite_set_flip_v>` **(** :ref:`bool<class_bool>` flip_v **)** |
  27. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_flipped_v<class_AnimatedSprite_is_flipped_v>` **(** **)** const |
  29. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_frame<class_AnimatedSprite_set_frame>` **(** :ref:`int<class_int>` frame **)** |
  31. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_frame<class_AnimatedSprite_get_frame>` **(** **)** const |
  33. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_modulate<class_AnimatedSprite_set_modulate>` **(** :ref:`Color<class_color>` modulate **)** |
  35. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Color<class_color>` | :ref:`get_modulate<class_AnimatedSprite_get_modulate>` **(** **)** const |
  37. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  38. Signals
  39. -------
  40. - **frame_changed** **(** **)**
  41. Description
  42. -----------
  43. Sprite node that can use multiple textures for animation.
  44. Member Function Description
  45. ---------------------------
  46. .. _class_AnimatedSprite_set_sprite_frames:
  47. - void **set_sprite_frames** **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)**
  48. Set the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  49. .. _class_AnimatedSprite_get_sprite_frames:
  50. - :ref:`SpriteFrames<class_spriteframes>` **get_sprite_frames** **(** **)** const
  51. Get the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  52. .. _class_AnimatedSprite_set_centered:
  53. - void **set_centered** **(** :ref:`bool<class_bool>` centered **)**
  54. When turned on, offset at (0,0) is the center of the sprite, when off, the top-left corner is.
  55. .. _class_AnimatedSprite_is_centered:
  56. - :ref:`bool<class_bool>` **is_centered** **(** **)** const
  57. Return true when centered. See :ref:`set_centered<class_set_centered>`.
  58. .. _class_AnimatedSprite_set_offset:
  59. - void **set_offset** **(** :ref:`Vector2<class_vector2>` offset **)**
  60. Set the offset of the sprite in the node origin. Position varies depending on whether it is centered or not.
  61. .. _class_AnimatedSprite_get_offset:
  62. - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
  63. Return the offset of the sprite in the node origin.
  64. .. _class_AnimatedSprite_set_flip_h:
  65. - void **set_flip_h** **(** :ref:`bool<class_bool>` flip_h **)**
  66. If true, sprite is flipped horizontally.
  67. .. _class_AnimatedSprite_is_flipped_h:
  68. - :ref:`bool<class_bool>` **is_flipped_h** **(** **)** const
  69. Return true if sprite is flipped horizontally.
  70. .. _class_AnimatedSprite_set_flip_v:
  71. - void **set_flip_v** **(** :ref:`bool<class_bool>` flip_v **)**
  72. If true, sprite is flipped vertically.
  73. .. _class_AnimatedSprite_is_flipped_v:
  74. - :ref:`bool<class_bool>` **is_flipped_v** **(** **)** const
  75. Return true if sprite is flipped vertically.
  76. .. _class_AnimatedSprite_set_frame:
  77. - void **set_frame** **(** :ref:`int<class_int>` frame **)**
  78. Set the visible sprite frame index (from the list of frames inside the :ref:`SpriteFrames<class_spriteframes>` resource).
  79. .. _class_AnimatedSprite_get_frame:
  80. - :ref:`int<class_int>` **get_frame** **(** **)** const
  81. Return the visible frame index.
  82. .. _class_AnimatedSprite_set_modulate:
  83. - void **set_modulate** **(** :ref:`Color<class_color>` modulate **)**
  84. Change the color modulation (multiplication) for this sprite.
  85. .. _class_AnimatedSprite_get_modulate:
  86. - :ref:`Color<class_color>` **get_modulate** **(** **)** const
  87. Return the color modulation for this sprite.