Class TiledMap
java.lang.Object
org.openpatch.scratch.extensions.tiled.TiledMap
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);
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetObjectsFromLayer(String name) Retrieves the objects from a specified layer in the tiled map.voidstampLayerToBackground(String name) Stamps a specified layer onto the background.voidstampLayerToForeground(String name) Stamps the specified layer to the foreground.toString()
-
Constructor Details
-
TiledMap
-
-
Method Details
-
getObjectsFromLayer
-
stampLayerToForeground
Stamps the specified layer to the foreground.- Parameters:
name- the name of the layer to be stamped to the foreground
-
stampLayerToBackground
Stamps a specified layer onto the background.- Parameters:
name- the name of the layer to be stamped onto the background
-
toString
-