TileLayerData

TileLayerData

Tile layer data object stores info about how to render a tile

Constructor

# new TileLayerData(tileopt, directionopt, mirroropt, coloropt)

Create a tile layer data object, one for each tile in a TileLayer
Parameters:
Name Type Attributes Default Description
tile Number <optional>
The tile to use, untextured if undefined
direction Number <optional>
0 Integer direction of tile, in 90 degree increments
mirror Boolean <optional>
0 If the tile should be mirrored along the x axis
color Color <optional>
new Color(1,1,1) Color of the tile
Example
// create tile layer data with tile index 0 and random orientation and color
const tileIndex = 0;
const direction = randInt(4)
const mirror = randInt(2);
const color = randColor();
const data = new TileLayerData(tileIndex, direction, mirror, color);

Members

# color

Properties
Type Description
Color Color of the tile

# direction

Properties
Type Description
Number Integer direction of tile, in 90 degree increments

# mirror

Properties
Type Description
Boolean If the tile should be mirrored along the x axis

# tile

Properties
Type Description
Number The tile to use, untextured if undefined

Methods

# clear()

Set this tile to clear, it will not be rendered