Replace Tile X with Y

Dear Tiled community,

is there a simple way to replace tiles? Lets say I have one level design for a game A and want to use the same in game B. I copy the tiled map into a new tile map for game B. So I have one level.tmx with two tile mapsheets for each game A and B.
Now I need to replace the tile X of game A with tile X of game B.

Is there a fast way to do this? Tilesheets can’t be just changed because I want to modify the level after replace all tiles.

Have a nice day,

I am not entirely sure what you mean with this… But I can list you the options you have currently:

  1. Simply edit the .tmx file in a texteditor (better close tiled before doing this) and change the reference to the tileset in the xml structure there.
  2. If the tilesets do not have an identical structure you can still write a tool which you hand a mapping of your old tiles to the new tiles which then recalculates the ids. (if you save in a non compressed format this might even be possible with some relatively simple find&replace rules)
  3. Create automapping rules to map each tile to the new tile… results in the same as 2. but might be a lot more hassle to set up…

Otherwise Tiled has no procedure to assist this currently…


Thank you for your reply.

I have two games with kind of the same game but different features. But I use TileMaps in booth games with the same game mechanics.
Booth game have their TileSheets with different orders but the same tile types in it.

So I want to use Level1.tmx of game A in my game B. I can’t use Level1.tmx of game A and just change the TileSheet to game B. That will NOT work.
I need to replace all tiles with the other tiles of the new games.

How can I use the automapping rules for example tile1 of game A to tile1 of game B?
What does the magic wand do?


Dear Tiled community,

lets just say I want to replace two tiled because I changed my TileSheet.
So I created tons of levels and now I changed my tileSheet (changed different tiles to other positions in the TileSheet). Therefor my levels look totally strange.
I now need to replace every tile of the levels with the new tiles that I changed.

Don’t ask why I did that - was for a good reason :slight_smile:

Can I use the Automap function to replace lets say tile id 11 with tile id 34 and so on??

Have a nice day,

To modify the tile IDs in tons of levels, you should probably write a script. You could do it in C++ based on libtiled, but there are some libraries available that could be easier to get started with, like the Python tmxlib.

For the original question, a feature to swap a pair of tiles is pending merge:

However, for processing multiple maps and with several tiles to swap, this would still be very annoying and labour-intense.

Hello bjorn,

thank you for your response.

That sound exactly like what I want to do:

How can I use this patch/plugin?

Have a nice day,

@XCoder The referred pull request is now merged and I’ve extended it to apply to the entire map (including object layers), rather than just the current tile layer. It will soon be available in the snapshot builds.