Struct AnimatedSprite
Sprite node that can use multiple textures for animation.
struct AnimatedSprite
;
Animations are created using a SpriteFrames
resource, which can be configured in the editor via the SpriteFrames panel.
Properties
Name | Type | Description |
---|---|---|
animation [get, set]
|
String | The current animation from the frames resource. If this value changes, the frame counter is reset.
|
centered [get, set]
|
bool | If true , texture will be centered.
|
flipH [get, set]
|
bool | If true , texture is flipped horizontally.
|
flipV [get, set]
|
bool | If true , texture is flipped vertically.
|
frame [get, set]
|
long | The displayed animation frame's index. |
frames [get, set]
|
SpriteFrames | The SpriteFrames resource containing the animation(s).
|
offset [get, set]
|
Vector2 | The texture's drawing offset. |
playing [get, set]
|
bool | If true , the animation is currently playing.
|
speedScale [get, set]
|
double | The animation speed is multiplied by this value. |
Methods
Name | Description |
---|---|
_isPlaying
|
|
_resChanged
|
|
_setPlaying
|
|
getAnimation
|
|
getFrame
|
|
getOffset
|
|
getSpeedScale
|
|
getSpriteFrames
|
|
isCentered
|
|
isFlippedH
|
|
isFlippedV
|
|
isPlaying
|
Returns true if an animation is currently being played.
|
play
|
Plays the animation named anim . If no anim is provided, the current animation is played. If backwards is true , the animation will be played in reverse.
|
setAnimation
|
|
setCentered
|
|
setFlipH
|
|
setFlipV
|
|
setFrame
|
|
setOffset
|
|
setSpeedScale
|
|
setSpriteFrames
|
|
stop
|
Stops the current animation (does not reset the frame counter). |