Struct MapData

Top-level Tiled structure - encapsulates all data in the map file.

Fields

Name Type Description
backgroundColor string Hex-formatted background color (#RRGGBB)
layers LayerData[] All map layers (tiles and objects)
nextObjectId int Global counter across all objects
numCols int Number of tile columns
numRows int Number of tile rows
orientation MapData.Orientation Orthogonal, isometric, or staggered
properties string[string] Key-value property pairs on map
renderOrder string Rendering direction (orthogonal only)
tileHeight int General grid size. Individual tiles sizes may differ.
tilesets TilesetData[] All tile sets defined in this map
tileWidth int General grid size. Individual tiles sizes may differ.

Methods

Name Description
getLayer Fetch a map layer by its name. No check for layers with duplicate names is performed. Throws if no layer has a matching name (case-sensitive).
getTileset Fetch a tileset by its name. No check for layers with duplicate names is performed. Throws if no tileset has a matching name (case-sensitive).
getTileset Fetch the tileset containing the tile a given GID. Throws if the gid is out of range for all tilesets
load Load a Tiled map from a JSON file. Throws if no file is found at that path or if the parsing fails.
save Save a Tiled map to a JSON file.

Enums

Name Description
Orientation Map orientation.
RenderOrder The order in which tiles on tile layers are rendered. From the docs: Valid values are right-down (the default), right-up, left-down and left-up. In all cases, the map is drawn row-by-row. (since 0.10, but only supported for orthogonal maps at the moment)

Authors

rcorre

Copyright

Copyright © 2015, Ryan Roden-Corrent

License

MIT