The name of the tileset in the map data.
The first tile index this tileset contains.
OptionaltileWidth: number
Width of each tile (in pixels). Default 32.
OptionaltileHeight: number
Height of each tile (in pixels). Default 32.
OptionaltileMargin: number
The margin around all tiles in the sheet (in pixels). Default 0.
OptionaltileSpacing: number
The spacing between each tile in the sheet (in pixels). Default 0.
OptionaltileProperties: object
Custom properties defined per tile in the Tileset. These typically are custom properties created in Tiled when editing a tileset. Default {}.
OptionaltileData: object
Data stored per tile. These typically are created in Tiled when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor. Default {}.
OptionaltileOffset: object
Tile texture drawing offset. Default {x: 0, y: 0}.
The number of frames above which a tile is considered to have many animation frames. This is used to optimize rendering. If a tile has fewer frames than this, frames are searched using a linear search. If a tile has more, frames are searched using a binary search.
ReadonlycolumnsThe number of tile columns in the tileset.
The starting index of the first tile index this Tileset contains.
ReadonlyglThe gl texture used by the WebGL renderer.
ReadonlyimageThe cached image that contains the individual tiles. Use setImage to set.
ReadonlymaxThe maximum length of any animation in this tileset, in frames.
This is used internally to optimize rendering.
It is updated when createAnimationDataTexture is called.
The name of the Tileset.
ReadonlyrowsThe number of tile rows in the tileset.
ReadonlytexThe look-up table to specific tile image texture coordinates (UV in pixels). Each element contains the coordinates for a tile in an object of the form {x, y}.
Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within the Tileset collision editor. This is where collision objects and terrain are stored.
ReadonlytileThe height of each tile (in pixels). Use setTileSize to change.
ReadonlytileThe margin around the tiles in the sheet (in pixels). Use setSpacing to change.
Controls the drawing offset from the tile origin. Defaults to 0x0, no offset.
Tileset-specific properties per tile that are typically defined in the Tiled editor in the Tileset editor.
ReadonlytileThe spacing between each tile in the sheet (in pixels). Use setSpacing to change.
ReadonlytileThe width of each tile (in pixels). Use setTileSize to change.
ReadonlytotalThe total number of tiles in the tileset.
Returns true if and only if this Tileset contains the given tile index.
The unique id of the tile across all tilesets in the map.
undefined
Creates a new WebGLTexture for the tileset's animation data.
The renderer to use.
The new WebGLTexture.
Returns the ID of the tile to use, given a base tile and time, according to the tile's animation properties.
If the tile is not animated, this method returns the base tile ID.
The unique id of the tile across all tilesets in the map.
The current time in milliseconds.
The tile ID to use, or null if the tile is not contained in this tileset.
Get or create the map from tile index to animation data index.
This is used by TilemapGPULayer to animate tiles.
The renderer to use.
The map from tile index to animation data index.
Get or create the texture containing the animation data for this tileset.
This is used by TilemapGPULayer to animate tiles.
The renderer to use.
The animation data texture.
Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not contained in this Tileset. This is typically defined within Tiled's tileset collision editor.
The unique id of the tile across all tilesets in the map.
undefined
Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained in this Tileset. This is typically defined in Tiled and will contain both Tileset collision info and terrain mapping.
The unique id of the tile across all tilesets in the map.
undefined
Get a tile's properties that are stored in the Tileset. Returns null if tile index is not contained in this Tileset. This is typically defined in Tiled under the Tileset editor.
The unique id of the tile across all tilesets in the map.
undefined
Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index. Returns null if tile index is not contained in this Tileset.
The unique id of the tile across all tilesets in the map.
Object in the form { x, y } representing the top-left UV coordinate within the Tileset image.
Sets the tile margin and spacing and updates the tile data (rows, columns, etc.).
Optionalmargin: number
The margin around the tiles in the sheet (in pixels).
Optionalspacing: number
The spacing between the tiles in the sheet (in pixels).
This Tileset object.
Sets the tile width & height and updates the tile data (rows, columns, etc.).
OptionaltileWidth: number
The width of a tile in pixels.
OptionaltileHeight: number
The height of a tile in pixels.
This Tileset object.
Updates tile texture coordinates and tileset data.
The (expected) width of the image to slice.
The (expected) height of the image to slice.
OptionaloffsetX: number
The x offset in the source texture where the tileset starts. Default 0.
OptionaloffsetY: number
The y offset in the source texture where the tileset starts. Default 0.
This Tileset object.
A Tileset is a combination of a single image containing the tiles and a container for data about each tile. It maps tile indexes (GIDs) to positions within the tileset image, stores per-tile properties and collision data, and supports tile spacing and margin. Tilesets are created automatically when parsing Tiled map data and are used by TilemapLayer during rendering.