Possible to uniquely identify tiles? And possible to move already-placed tiles in batch?

I’ve created a collision overlay layer, which makes it easy to make the change in my Tiled GUI and have my own code that handles any inputs. However, what if I have a specific tile that should have an action attached to it? Or even a door that I want to uniquely identify and link to another map/door? Is there a way to “mark” that tile so that my code can distinguish it? I can distinguish some tiles from one another with the IDs that the json file spits out, but I want even more granularity.

Also, is there an easy way to drag tiles that you’ve already placed? I have been using the offset map functionality on highlighted parts but it’s not intuitive.

Objects or additional Tile Layers can be used to mark specific spots as having particular properties.

You can’t drag tiles, but you can cut+paste them. There is this scripted Move Tiles Tool, but it’s not really more convenient than cut+pasting.

That’s perfect. Can I select an any sort of square pattern or only rectangles? I can across the rectangle selector tool.

Custom properties look great as well. is there a way to apply the same label quickly to all the same tiles? Maybe “tree” for all trees that I place all and in the future. Also is it possible to have an array as a custom property? Like what would be my best option for storing a list of “messages”? I suppose I could use a string and create my own delimeter.

In addition to the Rectangular Select, you can also use the Magic Wand and Select Same Tile tools to select based on existing tiles. With the various modifier keys, you can add, subtract, and intersect to create more complex selections.

If you want a property to always be on all instances of a particular tile, the intended way is to assign that property to the tile itself, in the tileset. If you want it on all instances just in the current map, if you’re using tiles for the extra data, you can use Select Same Tile and then fill the area with your data tile on another layer. If you’re using Objects, there’s no easy way, but if you don’t want to place the Objects manually, you can use Automapping to output Objects wherever those tiles are found.

Array custom properties are currently not supported (but that is a planned feature). For now, you can use a string property, or multiple properties with array-like names (e.g. prop[1], prop[2]) that you can parse into arrays in your game.


Thanks you, I will give all of this a try


In order to do what you’re saying, I’ll need to use the custom types editor right? For some reason it’s grayed out for me.

You do not need custom types to do anything I wrote above. What I described uses custom properties, not custom types.

To answer your implied question though: it’s greyed out because you must have a Project to store the custom types in. But you don’t need this, you can assign the properties to the tiles/objects/whatever in the Properties panel. Custom types are for when you want to define complex property types or set default values for particular classes.

Apologies, conflated terms and my needs. If i select a tile, the property column on the left updates but is grayed as well

You can only edit tiles in the Tileset Editor. While you’re in the Map Editor, the properties are greyed out.

1 Like

If you are reading the TMX file programatically, the “data” node should have all of the “global” tile-ids that you have placed on your visual map. BY subtracting “1” from each number you will then get the “local” id that is stored in the TSX file. You can relate these two as a result and get the actual name of the tile for any x,y position.

I have the code for this if you would like me to post it for you. It uses the Open Source utility, “TiledCS” to get the primary attributes of each file so that you can get to the actual data you require to handle…

Note that this is only accurate if your maps can only ever have at most one tileset. The more robust approach is to subtract the tileset’s firstgid from the tile to get its local tile ID. The GIDs and firstgids are what allow you to distinguish between tiles from different tilesets in a single map. More info in the docs: Global Tile IDs — Tiled 1.10.2 documentation

Thank you, Eishiya, for elaborating on this.

Since I am only using a single tileset, I did not consider this issue.

Technically, there’s no guarantee in the TMX format that even with a single tileset the firstgid will be 1. Tiled always writes them that way, but the format allows for any firstgid. Of course, this is a rather unlikely scenario that would require the user to use a program other than Tiled to edit the map, so it’s probably not too weird to disregard it.

…why is this conversation happening in this thread, though? Nothing in the OP’s questions has to do with parsing layer data.

From the initial comment, the author was referring to understanding the tile ids through programming…