Home Reference Source Test Repository
import {TileMap} from 'dtile-tilemap/src/tilemap.js'
public class | source

TileMap

A tilemap object with name, sizes and layers.

Test:

Constructor Summary

Public Constructor
public

constructor(options: object)

TileMap constructor.

Member Summary

Public Members
public

The height of the tilemap.

public

All layers of the tilemap

public

The name of the tilemap.

public

Custom properties of the tilemap.

public

The height of a tile for the tilemap.

public

The width of a tile for the tilemap.

public

The width of the tilemap.

Method Summary

Public Methods
public

Creates a new layer and adds it to the tilemap.

Public Constructors

public constructor(options: object) source

TileMap constructor.

Params:

NameTypeAttributeDescription
options object

Options for the tilemap. Can also be a tilemap you loaded from JSON or similar.

options.name string
  • optional
  • default: "Tilemap"

TileMap#name

options.width number

TileMap#width

options.height number

TileMap#height

options.tileWidth number

TileMap#tileWidth

options.tileHeight number

TileMap#tileHeight

options.layers layerOption[]
  • optional
  • default: []

Same structure as options in TileLayer#constructor

options.properties Map<string, *>
  • optional
  • default: Map

TileMap#properties

Test:

Public Members

public height: number source

The height of the tilemap.

public layers: TileLayer[] source

All layers of the tilemap

public name: string source

The name of the tilemap.

public properties: Map<string, *> source

Custom properties of the tilemap.

public tileHeight: number source

The height of a tile for the tilemap.

public tileWidth: number source

The width of a tile for the tilemap.

public width: number source

The width of the tilemap.

Public Methods

public createLayer(options: object): TileLayer source

Creates a new layer and adds it to the tilemap.

Params:

NameTypeAttributeDescription
options object

Options for the layer (see TileLayer).

Return:

TileLayer