Class: TileMap

graphics.tmx. TileMap


new TileMap( [init])

A flexible standard implementation to describe a tile based map.

A flexible standard implementation to describe a tile based map.

The tilewidth and tileheight properties determine the general grid size of the map. The individual tiles may have different sizes. Larger tiles will extend at the top and right (anchored to the bottom left).

A map contains three different kinds of layers. Tile layers were once the only type, and are simply called layer, object layers have the objectgroup tag and image layers use the imagelayer tag. The order in which these layers appear is the order in which the layers are rendered by Tiled.

Can contain: properties, tileset, layer, objectgroup, imagelayer

Parameters:
Name Type Argument Description
init Object <optional>

A generic object containing properties with which to populate the newly instance. If this argument is null, it is ignored.

See:

Extends

Members


backgroundcolor :string

The background color of the map. (since 0.9, optional, may include alpha value since 0.15 in the form #AARRGGBB).

Type:
  • string
Default Value:
  • null

height :number

The TMX height in tiles.

Type:
  • number
Default Value:
  • 0

hexsidelength :number

Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile's edge, in pixels.

Type:
  • number
Default Value:
  • 0

layers :Array

An array of objects with layers data. Structure of each object can vary, basing on layer type.

Type:
Default Value:
  • null
See:

nextobjectid

Stores the next available ID for new objects. This number is stored to prevent reuse of the same ID after objects have been removed. (since 0.11)


orientation :string

The tmx.TileMap orientation. Tiled supports "orthogonal", "isometric", "staggered" (since 0.9) and "hexagonal" (since 0.11).

Type:
  • string
See:

properties :Array

An array of all user-defined properties of map.

Type:
Default Value:
  • null

properties :Array

An array of all user-defined properties of map.

Type:
Default Value:
  • null

renderorder :string

The order in which tiles on tile layers are rendered. Valid values are right-down (the default), right-up, left-down and left-up. In all cases, the map is drawn row-by-row. (since 0.10, but only supported for orthogonal maps at the moment).

Type:
  • string
Default Value:
  • TileMapRenderOrder.RIGHT_DOWN
See:

staggeraxis :string

For staggered and hexagonal maps, determines which axis ("x" or "y") is staggered. (since 0.11)

Type:
  • string
Default Value:
  • null

staggerindex :string

For staggered and hexagonal maps, determines whether the "even" or "odd" indexes along the staggered axis are shifted. (since 0.11)

Type:
  • string
Default Value:
  • null

tileheight :number

The TMX height of a tile.

Type:
  • number
Default Value:
  • 0

tilesets :Array

An array of objects with description of used tiles in the map.

Type:
Default Value:
  • null

tilewidth :number

The TMX width of a tile.

Type:
  • number
Default Value:
  • 0

version :number

The TMX format version, generally 1.0.

Type:
  • number
Default Value:
  • 1

width :number

The TMX width in tiles.

Type:
  • number
Default Value:
  • 0

Methods


clone()

Returns a shallow copy of the object.

Inherited From:
Returns:

a shallow copy of the object.


setTo(init)

Sets the members of the object to the specified values.

Parameters:
Name Type Description
init Object

The generic object to initialize the object.

Inherited From:
Returns:

The current object reference.


toObject()

Returns the Object representation of this object.

Overrides:
Returns:

the Object representation of this object.


toString()

Returns the string representation of this object.

Inherited From:
Returns:

the string representation of this object.