TiledMap()
Browser availability: desktop-only.
This API requires the desktop runtime. Browser declarations may report the limitation without performing the operation.
The TiledMap class represents a map created using the Tiled map editor. It provides methods to load the map from an XML file, retrieve objects from layers, and stamp layers onto the foreground or background of a stage.
Example usage:
TiledMap map = new TiledMap("assets/map.tmx", stage);
map.stampLayerToForeground("foreground");
for (MapObject object : map.getObjectsFromLayer("objects")) {
if (object.type.equals("player")) {
Player p = new Player(object.x, object.y);
stage.addSprite(p);
}
}
Syntax
Java
new TiledMap(path, stage)