API Docs for:
Show:

Sprite Class

A component class that holds the graphical representation of the entity.

Constructor

Sprite

(
  • spriteSheetHandle
  • spriteIndex
  • zIndex
)

Parameters:

  • spriteSheetHandle AssetHandle

    Handle to the sprite sheet asset which has this entity's sprite.

  • spriteIndex Number

    The sprite's index in the sprite sheet's array of sprites.

  • zIndex Number

    The sprite's z-index describes the rendering order. Sprites with a higher z-index are rendered on top of sprites with a lower z-index.

Methods

getSpriteIndex

() Number

Returns:

Number: Index of this sprite in the sprite sheet.

getSpriteSheetHandle

() AssetHandle

Returns:

AssetHandle: Direct reference to the asset handle to the sprite sheet this sprite is in.

getZIndex

() Number

Returns:

Number: The sprite's z-index, which describes the rendering order.

setSpriteIndex

(
  • spriteIndex
)

Parameters:

  • spriteIndex Number

    Index of this sprite in the sprite sheet.

setSpriteSheetHandle

(
  • spriteSheetHandle
)

Parameters:

  • spriteSheetHandle AssetHandle

    Handle to the sprite sheet this sprite is in.

setZIndex

(
  • zIndex
)

Parameters:

  • zIndex Number

    The sprite's z-index, which describes the rendering order.