Sprite node that can use multiple textures for animation.
    public class AnimatedSprite : Node2D

Animations are created using a SpriteFrames resource, which can be configured in the editor via the SpriteFrames panel.

Inheritance Chain


    public AnimatedSprite()


    "animation_finished" ()

Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn.

    "frame_changed" ()

Emitted when Frame changed.


    public string Animation { get; set; }

The current animation from the frames resource. If this value changes, the frame counter is reset.

    public bool Centered { get; set; }

If true texture will be centered. Default value: true.

    public bool FlipH { get; set; }

If true texture is flipped horizontally. Default value: false.

    public bool FlipV { get; set; }

If true texture is flipped vertically. Default value: false.

    public int Frame { get; set; }

The displayed animation frame’s index.

    public SpriteFrames Frames { get; set; }

The SpriteFrames resource containing the animation(s).

    public Vector2 Offset { get; set; }

The texture’s drawing offset.

    public bool Playing { get; set; }

If true the Animation is currently playing.


    public string GetAnimation()

Getter for Animation

    public int GetFrame()

Getter for Frame

    public Vector2 GetOffset()

Getter for Offset

    public SpriteFrames GetSpriteFrames()

Getter for Frames

    public bool IsCentered()

Getter for Centered

    public bool IsFlippedH()

Getter for FlipH

    public bool IsFlippedV()

Getter for FlipV

    public bool IsPlaying()

Return true if an animation if currently being played.

    public void Play(string anim = "")

Play the animation set in parameter. If no parameter is provided, the current animation is played.

    public void SetAnimation(string animation)

Setter for Animation

    public void SetCentered(bool centered)

Setter for Centered

    public void SetFlipH(bool flipH)

Setter for FlipH

    public void SetFlipV(bool flipV)

Setter for FlipV

    public void SetFrame(int frame)

Setter for Frame

    public void SetOffset(Vector2 offset)

Setter for Offset

    public void SetSpriteFrames(SpriteFrames spriteFrames)

Setter for Frames

    public void Stop()

Stop the current animation (does not reset the frame counter).