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

NameTypeDescription
animation[get, set] StringThe current animation from the frames resource. If this value changes, the frame counter is reset.
centered[get, set] boolIf true, texture will be centered.
flipH[get, set] boolIf true, texture is flipped horizontally.
flipV[get, set] boolIf true, texture is flipped vertically.
frame[get, set] longThe displayed animation frame's index.
frames[get, set] SpriteFramesThe SpriteFrames resource containing the animation(s).
offset[get, set] Vector2The texture's drawing offset.
playing[get, set] boolIf true, the animation is currently playing.
speedScale[get, set] doubleThe animation speed is multiplied by this value.

Methods

NameDescription
_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).