AnimatedSprite

Inherits: Node2D < CanvasItem < Node < Object

Nodo Sprite que puede usar múltiples texturas para la animación.

Descripción

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

Note: You can associate a set of normal maps by creating additional SpriteFrames resources with a _normal suffix. For example, having 2 SpriteFrames resources run and run_normal will make it so the run animation uses the normal map.

Tutoriales

Propiedades

String

animation

"default"

bool

centered

true

bool

flip_h

false

bool

flip_v

false

int

frame

0

SpriteFrames

frames

Vector2

offset

Vector2( 0, 0 )

bool

playing

false

float

speed_scale

1.0

Métodos

void

play ( String anim="", bool backwards=false )

void

stop ( )

Señales

  • animation_finished ( )

Se emite cuando la animación termina (cuando reproduce el último fotograma). Si la animación está en bucle, esta señal se emite cada vez que se reproduce el último fotograma.


  • frame_changed ( )

Emitido cuando frame cambió.

Descripciones de Propiedades

Default

"default"

Setter

set_animation(value)

Getter

get_animation()

La animación actual del recurso frames. Si este valor cambia, el contador frame se reinicia.


Default

true

Setter

set_centered(value)

Getter

is_centered()

Si true, la textura se centrará.


Default

false

Setter

set_flip_h(value)

Getter

is_flipped_h()

Si true, la textura se voltea horizontalmente.


Default

false

Setter

set_flip_v(value)

Getter

is_flipped_v()

Si true, la textura se voltea verticalmente.


Default

0

Setter

set_frame(value)

Getter

get_frame()

El índice del cuadro de animación mostrado.


Setter

set_sprite_frames(value)

Getter

get_sprite_frames()

El recurso SpriteFrames que contiene la(s) animación(es).


Default

Vector2( 0, 0 )

Setter

set_offset(value)

Getter

get_offset()

El desplazamiento al dibujar de la textura.


Default

false

Setter

set_playing(value)

Getter

is_playing()

Si true, la animation se está reproduciendo actualmente.


Default

1.0

Setter

set_speed_scale(value)

Getter

get_speed_scale()

La velocidad de la animación se multiplica por este valor.

Descripciones de Métodos

  • void play ( String anim="", bool backwards=false )

Reproduce la animación llamada anim. Si no se proporciona anim, se reproduce la animación actual. Si backwards es true, la animación se reproduce al revés.


  • void stop ( )

Detiene la animación actual (no reinicia el contador de fotogramas).