Draw. TileInfo

Tile Info - Stores info about how to draw a tile

Constructor

new TileInfo(posopt, sizeopt, textureInfoopt, paddingopt, bleedopt)

Create a tile info object

Parameters:
NameTypeAttributesDefaultDescription
posVector2<optional>
vec2()

Top left corner of tile in pixels

sizeVector2<optional>

Size of tile in pixels

textureInfoTextureInfo<optional>

Texture info to use

paddingnumber<optional>

How many pixels padding around tiles

bleednumber<optional>

How many pixels smaller to draw tiles

Members

bleed

Properties
TypeDescription
number

Shrinks tile by this many pixels to prevent neighbors bleeding

padding

Properties
TypeDescription
number

How many pixels padding around tiles

pos

Properties
TypeDescription
Vector2

Top left corner of tile in pixels

size

Properties
TypeDescription
Vector2

Size of tile in pixels

textureInfo

Properties
TypeDescription
TextureInfo

The texture info for this tile

Methods

frame(frame) → {TileInfo}

Returns a copy of this tile offset by a number of animation frames

Parameters:
NameTypeDescription
framenumber

Offset to apply in animation frames

Returns:
Type: 
TileInfo

offset(offset) → {TileInfo}

Returns a copy of this tile offset by a vector

Parameters:
NameTypeDescription
offsetVector2

Offset to apply in pixels

Returns:
Type: 
TileInfo

setFullImage(textureInfoopt) → {TileInfo}

Set this tile to use a full image in a texture info

Parameters:
NameTypeAttributesDescription
textureInfoTextureInfo<optional>
Returns:
Type: 
TileInfo

tile(indexopt) → {TileInfo}

Returns a tile info for an index using this tile as refrence

Parameters:
NameTypeAttributesDefaultDescription
indexVector2 | number<optional>
0
Returns:
Type: 
TileInfo