TileInfo

Tile Info - Stores info about how to draw a tile

Constructor

new TileInfo(posopt, sizeopt, textureIndexopt, paddingopt, bleedScaleopt)

Create a tile info object

Parameters:
NameTypeAttributesDefaultDescription
posVector2<optional>
(0,0)

Top left corner of tile in pixels

sizeVector2<optional>
tileSizeDefault

Size of tile in pixels

textureIndexnumber<optional>
0

Texture index to use

paddingnumber<optional>
0

How many pixels padding around tiles

bleedScalenumber<optional>

How many pixels smaller to draw tiles

Members

bleedScale

Properties
TypeDescription
float

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

textureIndex

Properties
TypeDescription
number

Texture index to use

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(image, glTextureopt) → {TileInfo}

Set this tile to use a full image

Parameters:
NameTypeAttributesDescription
imageHTMLImageElement | OffscreenCanvas
glTextureWebGLTexture<optional>

WebGL texture

Returns:
Type: 
TileInfo