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

Constructors

    public AnimatedSprite()

Signals

    "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.

Properties

    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.

    public bool FlipH { get; set; }

If true, texture is flipped horizontally.

    public bool FlipV { get; set; }

If true, texture is flipped vertically.

    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 float SpeedScale { get; set; }

The animation speed is multiplied by this value.

Methods

    [Obsolete("GetAnimation is deprecated. Use the Animation property instead.")]
    public string GetAnimation()

Getter for Animation

    [Obsolete("GetFrame is deprecated. Use the Frame property instead.")]
    public int GetFrame()

Getter for Frame

    [Obsolete("GetOffset is deprecated. Use the Offset property instead.")]
    public Vector2 GetOffset()

Getter for Offset

    [Obsolete("GetSpeedScale is deprecated. Use the SpeedScale property instead.")]
    public float GetSpeedScale()

Getter for SpeedScale

    [Obsolete("GetSpriteFrames is deprecated. Use the Frames property instead.")]
    public SpriteFrames GetSpriteFrames()

Getter for Frames

    [Obsolete("IsCentered is deprecated. Use the Centered property instead.")]
    public bool IsCentered()

Getter for Centered

    [Obsolete("IsFlippedH is deprecated. Use the FlipH property instead.")]
    public bool IsFlippedH()

Getter for FlipH

    [Obsolete("IsFlippedV is deprecated. Use the FlipV property instead.")]
    public bool IsFlippedV()

Getter for FlipV

    public bool IsPlaying()

Returns true if an animation is currently being played.

    public void Play(string anim = "", bool backwards = false)

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.

    [Obsolete("SetAnimation is deprecated. Use the Animation property instead.")]
    public void SetAnimation(string animation)

Setter for Animation

    [Obsolete("SetCentered is deprecated. Use the Centered property instead.")]
    public void SetCentered(bool centered)

Setter for Centered

    [Obsolete("SetFlipH is deprecated. Use the FlipH property instead.")]
    public void SetFlipH(bool flipH)

Setter for FlipH

    [Obsolete("SetFlipV is deprecated. Use the FlipV property instead.")]
    public void SetFlipV(bool flipV)

Setter for FlipV

    [Obsolete("SetFrame is deprecated. Use the Frame property instead.")]
    public void SetFrame(int frame)

Setter for Frame

    [Obsolete("SetOffset is deprecated. Use the Offset property instead.")]
    public void SetOffset(Vector2 offset)

Setter for Offset

    [Obsolete("SetSpeedScale is deprecated. Use the SpeedScale property instead.")]
    public void SetSpeedScale(float speedScale)

Setter for SpeedScale

    [Obsolete("SetSpriteFrames is deprecated. Use the Frames property instead.")]
    public void SetSpriteFrames(SpriteFrames spriteFrames)

Setter for Frames

    public void Stop()

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

Tags: