Class: TmxTileSet

TmxTileSet

FM.TmxTileSet

new TmxTileSet()

Object representing a tile set from a tile map.
Author:
  • Simon Chauvin
Source:

Members

firstGID :int

First ID of the tile of this tile set.
Type:
  • int
Source:

imageSource :Image

The image of the tile set.
Type:
  • Image
Source:

map :FM.TmxMap

Tile map that owns this tile set.
Type:
Source:

margin :int

Margin before tiles.
Type:
  • int
Source:

name :string

Name of the tile set.
Type:
  • string
Source:

numCols :int

Number of columns in the tile set.
Type:
  • int
Source:

numRows :int

Number of rows in the tile set
Type:
  • int
Source:

numTiles :int

Number of tiles in the tile set.
Type:
  • int
Source:

spacing :int

Spacing between tiles.
Type:
  • int
Source:

tileHeight :int

The height of a tile.
Type:
  • int
Source:

tileWidth :int

The width of a tile.
Type:
  • int
Source:

Methods

fromGid(pGid) → {int}

Retrieve the ID of a tile in the tile set from its global ID.
Parameters:
Name Type Description
pGid int The global ID of the tile.
Source:
Returns:
The ID of the tile in the tile set.
Type
int

getImage() → {Image}

Retrieve the image associated to this tile set.
Source:
Returns:
The image associated to the tile set.
Type
Image

getProperties(pId) → {FM.TmxPropertySet}

Retrieve the properties of a given tile's ID.
Parameters:
Name Type Description
pId int The ID of the tile to retrieve the properties from.
Source:
Returns:
The property set of the tile.
Type
FM.TmxPropertySet

getPropertiesByGid(pGid) → {FM.PropertySet}

Retrieve the properties of a particular tile by specifying the global ID of the tile.
Parameters:
Name Type Description
pGid int The global ID of the tile to retrieve the properties from.
Source:
Returns:
The property set of the tile.
Type
FM.PropertySet

getRect(pId) → {FM.Rectangle}

Retieve the rectangle of the given tile's ID.
Parameters:
Name Type Description
pId int The ID of the tile to retrieve the rectangle from.
Source:
Returns:
The rectangle of the tile.
Type
FM.Rectangle

hasGid(pGid) → {boolean}

Check if this tile set contains a given id of tile.
Parameters:
Name Type Description
pGid int The id of the tile to check the presence of in this tile set.
Source:
Returns:
Whether this tile set owns the given ID of tile.
Type
boolean

load(pTileSetNode, pParent)

Load the tile set.
Parameters:
Name Type Description
pTileSetNode string The xml node containing the data to load.
pParent FM.TmxMap The tile map containing this tile set.
Source:

setImage(pImage)

Provide the image of the tile set.
Parameters:
Name Type Description
pImage Image The image to use as tile set.
Source:

toGid(pId) → {int}

Retrieve the global ID of a tile.
Parameters:
Name Type Description
pId int The ID of the tile to retrieve the global ID from.
Source:
Returns:
The global ID of the tile.
Type
int