Skip to content
Minh Ngo edited this page Jan 5, 2015 · 3 revisions

A TileSet object contains a collection of tiles.


##Public ###Data TileSet.image (default: nil)
The Image of the TileSet. Note that this field is empty for tiles using their own images.

TileSet.imagesource (default: nil)
The relative path to the image.

TileSet.name (default: "Unnamed TileSet")
The name of the TileSet.

TileSet.tilewidth (default: nil)
The width of tiles contained in the TileSet.

TileSet.tileheight (default: nil)
The height of the tiles contained in the TileSet.

TileSet.firsgid (default: nil)
The starting gid.

TileSet.spacing (default: 0)
The spacing in pixels between each tile.

TileSet.margin (default: 0)
The margin in pixels surrounding the entire tile set.

TileSet.trans (default: nil)
The transparency hexadecimal value for the tileset in string format "aabbcc".

TileSet.offsetX (default: 0)
The X offset.

TileSet.offsetY (default: 0)
The Y offset.

TileSet.properties (default: {})
The tileset properties set in Tiled.

TileSet.tiles
The tiles indexed by their local id. Note that the index is 0 based.

TileSet.terraintypes
The terrains indexed by their id. Note that the index is 0 based.


###Functions TileSet(tilewidth, tileheight, image, firstgid, args)
Return a new TileSet object. args is an optional table for optional arguments. The default values are below:

args = {
	name       = "Unnamed TileSet",
	imagesource= nil,
	trans      = nil,
	spacing    = 0,
	margin     = 0,
	offsetX    = 0,
	offsetY    = 0,
	properties = {},
}

TileSet:columns()
Return the number of columns of tiles. This method doesn't work for tiles using their own images.

TileSet:rows()
Return the number of rows of tiles. This method doesn't work for tiles using their own images.

tileset(id)
Return a tile given its id.

Clone this wiki locally