Sprite¶
Inherits: Node2D < CanvasItem < Node < Object
Category: Core
Brief Description¶
General purpose Sprite node.
Member Functions¶
int | get_frame ( ) const |
int | get_hframes ( ) const |
Color | get_modulate ( ) const |
Vector2 | get_offset ( ) const |
Rect2 | get_region_rect ( ) const |
Texture | get_texture ( ) const |
int | get_vframes ( ) const |
bool | is_centered ( ) const |
bool | is_flipped_h ( ) const |
bool | is_flipped_v ( ) const |
bool | is_region ( ) const |
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_hframes ( int hframes ) |
void | set_modulate ( Color modulate ) |
void | set_offset ( Vector2 offset ) |
void | set_region ( bool enabled ) |
void | set_region_rect ( Rect2 rect ) |
void | set_texture ( Texture texture ) |
void | set_vframes ( int vframes ) |
Signals¶
- frame_changed ( )
Description¶
General purpose Sprite node. This Sprite node can show any texture as a sprite. The texture can be used as a spritesheet for animation, or only a region from a bigger texture can referenced, like an atlas.
Member Function Description¶
- int get_frame ( ) const
Return the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
- int get_hframes ( ) const
Return the amount of horizontal frames. See set_hframes.
- Color get_modulate ( ) const
Return color modulation for the sprite. All sprite pixels are multiplied by this color.
- Vector2 get_offset ( ) const
Return sprite draw offset.
- Rect2 get_region_rect ( ) const
Return the region rect to read from.
- Texture get_texture ( ) const
Return the base texture for the sprite.
- int get_vframes ( ) const
Return the amount of vertical frames. See set_vframes.
- bool is_centered ( ) const
Return if the sprite is centered at the local origin.
- bool is_flipped_h ( ) const
Return true if the sprite is flipped horizontally.
- bool is_flipped_v ( ) const
Return true if the sprite is flipped vertically.
- bool is_region ( ) const
Return if the sprite reads from a region.
- void set_centered ( bool centered )
Set whether the sprite should be centered on the origin.
- void set_flip_h ( bool flip_h )
Set true to flip the sprite horizontally.
- void set_flip_v ( bool flip_v )
Set true to flip the sprite vertically.
- void set_frame ( int frame )
Set the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
- void set_hframes ( int hframes )
Set the amount of horizontal frames and converts the sprite into a sprite-sheet. This is useful for animation.
- void set_modulate ( Color modulate )
Set color modulation for the sprite. All sprite pixels are multiplied by this color. Color may contain rgb values above 1 to achieve a highlight effect.
- void set_offset ( Vector2 offset )
Set the sprite draw offset, useful for setting rotation pivots.
- void set_region ( bool enabled )
Set the sprite as a sub-region of a bigger texture. Useful for texture-atlases.
- void set_region_rect ( Rect2 rect )
Set the region rect to read from.
- void set_texture ( Texture texture )
Set the base texture for the sprite.
- void set_vframes ( int vframes )
Set the amount of vertical frames and converts the sprite into a sprite-sheet. This is useful for animation.