Class: TileSet

graphics.tmx. TileSet


new TileSet( [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.

Extends

Members


columns :number

The number of tile columns in the tileset. For image collection tilesets it is editable and is used when displaying the tileset. (since 0.15)

Type:
  • number
Default Value:
  • 0

firstgid

The first global tile ID of this tileset (this global ID maps to the first tile in this tileset).


image

An tmx image information object.


margin :number

The margin around the tiles in this tileset (applies to the tileset image).

Type:
  • number
Default Value:
  • 0

name :string

The name of this tileset.

Type:
  • string

properties :Array

An array of all user-defined properties of map.

Type:
Default Value:
  • null

source :string

If this tileset is stored in an external TSX (Tile Set XML) file, this attribute refers to that file. That TSX file has the same structure as the element described here. (There is the firstgid attribute missing and this source attribute is also not there. These two attributes are kept in the TMX map, since they are map specific.)

Type:
  • string

spacing :number

The spacing in pixels between the tiles in this tileset (applies to the tileset image).

Type:
  • number
Default Value:
  • 0

terraintypes :Array

This element defines an array of terrain types, which can be referenced from the terrain attribute of the tile element.

Type:
Default Value:
  • null
See:

tilecount :number

The number of tiles in this tileset (since 0.13).

Type:
  • number
Default Value:
  • 0

tileheight :number

The (maximum) height of the tiles in this tileset.

Type:
  • number
Default Value:
  • 0

tileoffset :Object

This element is used to specify an offset in pixels, to be applied when drawing a tile from the related tileset. When not present, no offset is applied.

Type:
  • Object
Default Value:
  • null

tiles :Array

This element defines an array of tiles definitions.

Type:
Default Value:
  • null

tilewidth :number

The (maximum) width of the tiles in this tileset.

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.