Module ncine.base_sprite
The table containing base sprite related functions.
Inherits from ncine.drawable_node.
Functions
ncine.base_sprite.set_size (sprite, width, height) | Sets the sprite size |
ncine.base_sprite.get_texture (sprite) | Returns the texture object |
ncine.base_sprite.set_texture (sprite, texture) | Sets the texture object |
ncine.base_sprite.reset_texture (sprite) | Triggers a texture update without setting a new texture |
ncine.base_sprite.get_texrect (sprite) | Returns the texture source rectangle for blitting |
ncine.base_sprite.set_texrect (sprite, rect) | Sets the texture source rectangle for blitting |
ncine.base_sprite.is_flipped_x (sprite) | Returns true if the sprite texture is horizontally flipped |
ncine.base_sprite.set_flipped_x (sprite, flipped_x) | Flips the texture rect horizontally |
ncine.base_sprite.is_flipped_y (sprite) | Returns true if the sprite texture is vertically flipped |
ncine.base_sprite.set_flipped_y (sprite, flipped_y) | Flips the texture rect vertically |
Tables
basespriteObj | The light user data of a base sprite object. |
Functions
- ncine.base_sprite.set_size (sprite, width, height)
-
Sets the sprite size
Parameters:
- sprite basespriteObj
- width number
- height number
- ncine.base_sprite.get_texture (sprite)
-
Returns the texture object
Parameters:
- sprite basespriteObj
Returns:
-
ncine.texture.textureObj or nil
- ncine.base_sprite.set_texture (sprite, texture)
-
Sets the texture object
Parameters:
- sprite basespriteObj
- texture ncine.texture.textureObj or nil
- ncine.base_sprite.reset_texture (sprite)
-
Triggers a texture update without setting a new texture
Parameters:
- sprite basespriteObj
- ncine.base_sprite.get_texrect (sprite)
-
Returns the texture source rectangle for blitting
Parameters:
- sprite basespriteObj
Returns:
-
ncine.rect
- ncine.base_sprite.set_texrect (sprite, rect)
-
Sets the texture source rectangle for blitting
Parameters:
- sprite basespriteObj
- rect ncine.rect
- ncine.base_sprite.is_flipped_x (sprite)
-
Returns
true
if the sprite texture is horizontally flippedParameters:
- sprite basespriteObj
Returns:
-
boolean
- ncine.base_sprite.set_flipped_x (sprite, flipped_x)
-
Flips the texture rect horizontally
Parameters:
- sprite basespriteObj
- flipped_x boolean
- ncine.base_sprite.is_flipped_y (sprite)
-
Returns
true
if the sprite texture is vertically flippedParameters:
- sprite basespriteObj
Returns:
-
boolean
- ncine.base_sprite.set_flipped_y (sprite, flipped_y)
-
Flips the texture rect vertically
Parameters:
- sprite basespriteObj
- flipped_y boolean
Tables
- basespriteObj
-
The light user data of a base sprite object.
Inherits from ncine.drawable_node.drawablenodeObj.