Skip to content

class_sprite

reduz edited this page Feb 23, 2014 · 10 revisions

Sprite

Inherits: Node2D\n\n

Brief Description

General purpose Sprite node.

Member Functions

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

  • void set_centered ( bool centered ) \ Set whether the sprite should be centered on the origin.
  • bool is_centered ( ) const \ Return if the sprite is centered at the local origin.
  • void set_offset ( Vector2 offset ) \ Set the sprite draw offset, useful for setting rotation pivots.
  • void set_flip_h ( bool flip_h ) \ Set true to flip the sprite horizontaly.
  • bool is_flipped_h ( ) const \ Return true if the sprite is flipped horizontally.
  • void set_flip_v ( bool flip_v ) \ Set true to flip the sprite vertically.
  • bool is_flipped_v ( ) const \ Return true if the sprite is flipped vertically.
  • void set_region ( bool enabled ) \ Set the sprite as a sub-region of a bigger texture. Useful for texture-atlases.
  • bool is_region ( ) const \ Return if the sprite reads from a region.
  • void set_frame ( int frame ) \ Set the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
  • int get_frame ( ) const \ Return the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.
  • void set_vframes ( int vframes ) \ Set the amount of vertical frames and converts the sprite into a sprite-sheet. This is useful for animation.
  • int get_vframes ( ) const \ Return the amount of vertical frames. See [set_vframes].
  • void set_hframes ( int hframes ) \ Set the amount of horizontal frames and converts the sprite into a sprite-sheet. This is useful for animation.
  • int get_hframes ( ) const \ Return the amount of horizontal frames. See [set_hframes].
  • void set_modulate ( Color modulate ) \ Set color modulation for the sprite. All sprite pixels are multiplied by this color.
  • Color get_modulate ( ) const \ Return color modulation for the sprite. All sprite pixels are multiplied by this color.

Clone this wiki locally