Class: Sprite

World.Sprite(tile, parent, name)

This class acts as node type for drawing sprites. A sprite is build for rendering a single image in form of a Tile. If you are looking for animated sprites, tile maps or particles check out ASprite, SpriteBatch.
For basic usage see: Tutorial - Drawing Sprites

Constructor

new Sprite(tile, parent, name)

Constructs a new Sprite type node.
Parameters:
Name Type Description
tile Tile The initial tile of the sprite
parent Obj The parent node of the newly created. Adds the created to the parents children (same as in Obj#constructor)
name string The name of the node (see Obj#constructor)
Example
// add a sprite to the scene (could be found in Apate#init)
new World.Sprite(Tile.fromImage(<img>), this.scene, "demo-sprite")

Extends

  • Obj

Members

align :"center"|"corner"

Alignment of the sprite.

material :SpriteMaterial

The material of the sprite used for drawing.

tile :Tile

The tile of the sprite. Shorthand for tile.material.sprite.