class_animatedsprite.rst 8.1 KB

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