AnimatedSprite

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Sprite node that can use multiple textures for animation.

Member Functions

String

get_animation ( ) const

int

get_frame ( ) const

Color

get_modulate ( ) const

Vector2

get_offset ( ) const

SpriteFrames

get_sprite_frames ( ) const

bool

is_centered ( ) const

bool

is_flipped_h ( ) const

bool

is_flipped_v ( ) const

bool

is_playing ( ) const

void

play ( String anim=”” )

void

set_animation ( String animation )

void

set_centered ( bool centered )

void

set_flip_h ( bool flip_h )

void

set_flip_v ( bool flip_v )

void

set_frame ( int frame )

void

set_modulate ( Color modulate )

void

set_offset ( Vector2 offset )

void

set_sprite_frames ( SpriteFrames sprite_frames )

void

stop ( )

Signals

  • finished ( )

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

  • frame_changed ( )

Emitted when frame is changed.

Description

Sprite node that can use multiple textures for animation.

Member Function Description

  • String get_animation ( ) const

Return the name of the current animation set to the node.

  • int get_frame ( ) const

Return the visible frame index.

  • Color get_modulate ( ) const

Return the color modulation for this sprite.

Return the offset of the sprite in the node origin.

Get the SpriteFrames resource, which contains all frames.

  • bool is_centered ( ) const

Return true when centered. See set_centered.

  • bool is_flipped_h ( ) const

Return true if sprite is flipped horizontally.

  • bool is_flipped_v ( ) const

Return true if sprite is flipped vertically.

  • 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 set_animation ( String animation )

Set the current animation of the node and reinits the frame counter of the animation.

  • void set_centered ( bool centered )

When turned on, offset at (0,0) is the center of the sprite, when off, the top-left corner is.

  • void set_flip_h ( bool flip_h )

If true, sprite is flipped horizontally.

  • void set_flip_v ( bool flip_v )

If true, sprite is flipped vertically.

  • void set_frame ( int frame )

Set the visible sprite frame index (from the list of frames inside the SpriteFrames resource).

  • void set_modulate ( Color modulate )

Change the color modulation (multiplication) for this sprite.

  • void set_offset ( Vector2 offset )

Set the offset of the sprite in the node origin. Position varies depending on whether it is centered or not.

Set the SpriteFrames resource, which contains all frames.

  • void stop ( )

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