-
-
Notifications
You must be signed in to change notification settings - Fork 231
Tiled
Dani Alias edited this page Jun 23, 2025
·
3 revisions
Tiled is an open-source editor designed to create tile based game maps. It allows to arrange tiles from a tileset, define layers and place objects or collision shapes. Tiled saves the map in .tmx
(XML) or .json
formats, but only .tmx
files can be used in Axmol.
Save your files inside your Content
folder and load them using the following code:
auto tiledMap = TMXTiledMap::create("MyLevel.tmx");
tiledMap->setPosition(Vec2(0, 0));
this->addChild(tiledMap);
In order to access tile layers, you can use:
auto groundLayer = tiledMap->getLayer("GroundLayer");
// Do something with the layer
It's possible to access individual tiles:
Vec2 tilePosition = Vec2(1, 1); // column and row
int tileGID = groundLayer->getTileGIDAt(tilePosition);
// Get the Global ID of the tile in order to check if it's empty
if (tileGID != 0) {
auto tileSprite = groundLayer->getTileAt(tilePosition);
// Do something with the tile
}
- It only supports one tileset per layer.
- Embedded images are not supported.
- It only supports the XML format (the JSON format is not supported).