I'm trying to make a Side-Scrolling game that will allow you to place/remove tiles. I'm using the TileMap Editor to render the custom Tilemap but is there any way to add tiles? I have it where I can remove the tiles with .setTile(null) but is there anyway to get the properties from a tile in the TileMap Editor so that it can get the Texture/Tile to use so it can place the tile?!
You can create a
Cell and fill that with a tile from the
TileMapTileSet, then set that cell at (x, y) coordinates in a particular
For example, the following code sets the tile at (32, 64) in a layer to tile 42 from tile set tileset_name;
TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get("some_layer_name"); Cell cell = new Cell(); TiledMapTileSet tileSet = map.getTileSets().getTileSet("tileset_name"); cell.setTile(tileSet.getTile(42)); /* or some other id, identifying the tile */ layer.setCell(32, 64, cell); // 32 and 64 being x and y coordinates
In the above code
map is a