class_sprite - vkbsb/godot GitHub Wiki
Sprite
####Inherits: Node2D ####Category: Core
Brief Description
General purpose Sprite node.
Member Functions
- void set_texture ( Texture texture )
- Texture get_texture ( ) const
- void set_centered ( bool centered )
- bool is_centered ( ) const
- void set_offset ( Vector2 offset )
- Vector2 get_offset ( ) const
- void set_flip_h ( bool flip_h )
- bool is_flipped_h ( ) const
- void set_flip_v ( bool flip_v )
- bool is_flipped_v ( ) const
- void set_region ( bool enabled )
- bool is_region ( ) const
- void set_region_rect ( Rect2 rect )
- Rect2 get_region_rect ( ) const
- void set_frame ( int frame )
- int get_frame ( ) const
- void set_vframes ( int vframes )
- int get_vframes ( ) const
- void set_hframes ( int hframes )
- int get_hframes ( ) const
- void set_modulate ( Color modulate )
- Color get_modulate ( ) const
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
set_texture
- void set_texture ( Texture texture )
Set the base texture for the sprite.
get_texture
- Texture get_texture ( ) const
Return the base texture for the sprite.
set_centered
- void set_centered ( bool centered )
Set whether the sprite should be centered on the origin.
is_centered
- bool is_centered ( ) const
Return if the sprite is centered at the local origin.
set_offset
- void set_offset ( Vector2 offset )
Set the sprite draw offset, useful for setting rotation pivots.
get_offset
- Vector2 get_offset ( ) const
Return sprite draw offst.
set_flip_h
- void set_flip_h ( bool flip_h )
Set true to flip the sprite horizontaly.
is_flipped_h
- bool is_flipped_h ( ) const
Return true if the sprite is flipped horizontally.
set_flip_v
- void set_flip_v ( bool flip_v )
Set true to flip the sprite vertically.
is_flipped_v
- bool is_flipped_v ( ) const
Return true if the sprite is flipped vertically.
set_region
- void set_region ( bool enabled )
Set the sprite as a sub-region of a bigger texture. Useful for texture-atlases.
is_region
- bool is_region ( ) const
Return if the sprite reads from a region.
set_region_rect
- void set_region_rect ( Rect2 rect )
Set the region rect to read from.
get_region_rect
- Rect2 get_region_rect ( ) const
Return the region rect to read from.
set_frame
- void set_frame ( int frame )
Set the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
get_frame
- int get_frame ( ) const
Return the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
set_vframes
- void set_vframes ( int vframes )
Set the amount of vertical frames and converts the sprite into a sprite-sheet. This is useful for animation.
get_vframes
- int get_vframes ( ) const
Return the amount of vertical frames. See [set_vframes].
set_hframes
- void set_hframes ( int hframes )
Set the amount of horizontal frames and converts the sprite into a sprite-sheet. This is useful for animation.
get_hframes
- int get_hframes ( ) const
Return the amount of horizontal frames. See [set_hframes].
set_modulate
- void set_modulate ( Color modulate )
Set color modulation for the sprite. All sprite pixels are multiplied by this color.
get_modulate
- Color get_modulate ( ) const
Return color modulation for the sprite. All sprite pixels are multiplied by this color.