Hi. I’m new to Tiled.
I have not been able to find and answer on the forum yet, so I’ll just ask (even though it has been asked before probably):
How do I set a variable for a specific kind of tile in Tiled?
Let’s say I reuse the same tiles over and over again for the floor and I want to add those tiles to a variable (collidable: boolean).
Later I want to implement a quad tree and iterate over the tiles within it and see if the tiles are collidable (don’t want to use an object layer) and rects for that…
The problem was:
I can’t seem to add a property to a tile in my tileset because the option is greyed out in the properties panel.
How can I achieve this?
Thanks in advance.
Add it to the Tile in the Tileset Editor, not the Map Editor. Open your Tileset as a tab in Tiled, select your tile there, and you’ll be able to edit the properties, etc.
The Tileset Editor is what you see when you open the Tileset as a document/tab in Tiled. You can do this via File > Open…, or by clicking the “Edit Tileset” button at the bottom of the Tilesets view (the panel where you select tiles to paint with).
Last question though:
Does it make sense to select the entire tileset then and add this property everywhere and just tick it if… well… it’s collidable.
I don’t think there’s any benefit in adding a false boolean property to a load of tiles unless there’s something weird about your game engine xP I’d only select the collidable tiles, add the property to them, and set it to true.
Sure, why not? The overhead of such a property would be minimal and constant. So if i only t makes editing more pleasant to you, then go for it.
On the other hand you can copy entire properties between tiles, so adding a single property to just selected tiles is not that time-consuming. Just ctrl-v.
I just ended up using a TileLayer for the Collision-Layer and set the flag to true for the entire map.
This seemed more convenient as I now only have to check my surroundings with tiles that have this special flag (which is all in the collision layer)…