Skip to content
reduz edited this page Feb 23, 2014 · 10 revisions

Sprite

####Inherits: Node2D ####Category: Core

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&#95texture ( Texture texture )

Set the base texture for the sprite.

Return the base texture for the sprite.

  • void set&#95centered ( bool centered )

Set whether the sprite should be centered on the origin.

  • bool is&#95centered ( ) const

Return if the sprite is centered at the local origin.

  • void set&#95offset ( Vector2 offset )

Set the sprite draw offset, useful for setting rotation pivots.

Return sprite draw offst.

  • void set&#95flip&#95h ( bool flip_h )

Set true to flip the sprite horizontaly.

  • bool is&#95flipped&#95h ( ) const

Return true if the sprite is flipped horizontally.

  • void set&#95flip&#95v ( bool flip_v )

Set true to flip the sprite vertically.

  • bool is&#95flipped&#95v ( ) const

Return true if the sprite is flipped vertically.

  • void set&#95region ( bool enabled )

Set the sprite as a sub-region of a bigger texture. Useful for texture-atlases.

  • bool is&#95region ( ) const

Return if the sprite reads from a region.

  • void set&#95region&#95rect ( Rect2 rect )

Set the region rect to read from.

  • Rect2 get&#95region&#95rect ( ) const

Return the region rect to read from.

  • void set&#95frame ( int frame )

Set the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.

  • int get&#95frame ( ) const

Return the texture frame for a sprite-sheet, works when vframes or hframes are greater than 1.

  • void set&#95vframes ( int vframes )

Set the amount of vertical frames and converts the sprite into a sprite-sheet. This is useful for animation.

  • int get&#95vframes ( ) const

Return the amount of vertical frames. See [set_vframes].

  • void set&#95hframes ( int hframes )

Set the amount of horizontal frames and converts the sprite into a sprite-sheet. This is useful for animation.

  • int get&#95hframes ( ) const

Return the amount of horizontal frames. See [set_hframes].

  • void set&#95modulate ( Color modulate )

Set color modulation for the sprite. All sprite pixels are multiplied by this color.

  • Color get&#95modulate ( ) const

Return color modulation for the sprite. All sprite pixels are multiplied by this color.

Clone this wiki locally