Struct TilesetData

A TilesetData maps GIDs (Global IDentifiers) to tiles.

Each tileset has a range of GIDs that map to the tiles it contains. This range starts at firstGid and extends to the firstGid of the next tileset. The index of a tile within a tileset is given by tile.gid - tileset.firstGid. A tileset uses its image as a 'tile atlas' and may specify per-tile properties.

Fields

Name Type Description
firstGid uint The GID that maps to the first tile in this set
image string Image used for tiles in this set
imageHeight int Height of source image in pixels
imageWidth int Width of source image in pixels
margin int Buffer between image edge and tiles (in pixels)
name string Name given to this tileset
properties string[string] Properties assigned to this tileset
spacing int Spacing between tiles in image (in pixels)
tileHeight int Maximum height of tiles in this set
tileproperties string[string][string] Optional per-tile properties, indexed by the relative ID as a string.
tileWidth int Maximum width of tiles in this set

Properties

Name Type Description
numCols [get] int Number of tile rows in the tileset
numRows [get] int Number of tile rows in the tileset
numTiles [get] int Total number of tiles defined in the tileset

Methods

Name Description
tileCol Find the grid position of a tile within this tileset.
tileOffsetX Find the pixel position of a tile within this tileset.
tileOffsetY Find the pixel position of a tile within this tileset.
tileProperties Find the properties defined for a tile in this tileset.
tileRow Find the grid position of a tile within this tileset.

Authors

rcorre

Copyright

Copyright © 2015, Ryan Roden-Corrent

License

MIT