AnimatedSprite

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Sprite node that can use multiple textures for animation.

Member Functions

bool is_playing ( ) const
void play ( String anim=”” )
void stop ( )

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.

Member Variables

  • String animation - The current animation from the frames resource. If this value changes, the frame counter is reset.
  • bool centered - If true texture will be centered. Default value: true.
  • bool flip_h - If true texture is flipped horizontally. Default value: false.
  • bool flip_v - If true texture is flipped vertically. Default value: false.
  • int frame - The displayed animation frame’s index.
  • SpriteFrames frames - The SpriteFrames resource containing the animation(s).
  • Vector2 offset - The texture’s drawing offset.
  • bool playing - If true the animation is currently playing.

Description

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

Member Function Description

  • bool is_playing ( ) const

Return true if an animation if currently being played.

  • void play ( String anim=”” )

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

  • void stop ( )

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