Hi, I was wondering if there was a way to assign a single tile ID to an n x m collection of tiles.
The tile size in my tilesheet is 16x16px, however there are objects like a house or fountain that are a 5x5 grid of smaller tiles, each with a different ID. I want to have this 5x5 collection of tiles have a single ID to export. This is making map parsing hard for me, and I was wondering if there’s a way around this.
No, there is no way in Tiled to represent five distinct tiles with one ID, unless you implement a custom export format. What you can do, however, is make larger tiles that include your entire house, fountain, etc, as a single tile. They would be larger than your map grid, so you’d need to be careful to avoid placing unnecessary tiles next to them - since they only take up the cell they were placed in and not the cells they visually overlap, they won’t prevent the Fill Bucket, select, etc tools from working with those overlapped cells.
- Based on Tileset Image tilesets only allow you to split the image up into uniformly-sized rectangles. If you want to only use those, you’d have to make a separate tileset and set their tile size 5x larger and possibly adjust the margin. If your large items are aligned to a 5x5 grid, then this should be easy. If they’re not, you may need to employ multiple such tilesets with different margins to capture all those tiles ):
- Image Collections are the only way you can have multiple tile sizes within a single tileset, and they let you use any subrectangle of an image for a tile (as of Tiled 1.9). You can create an Image Collection tileset and add your tileset image to it multiple times, using a different subrect for each. If you have a large tileset where most tiles are normal-size, this’ll probably be too tedious (though it is currently the only way to have all those tiles in a single tileset using a single tileset image), but maybe you can create such a tileset for just the larger tiles, so you’d use tiles from your normal “Based on Tileset Image” tileset, and use tiles from the Image Collection when you want the large props.
There is an issue open on GitHub to add a new Tile Atlas tileset type that takes a single image, but lets you define any rectangle on that image as a tile, which would make this easier: Change tileset definition to avoid renumbering tiles when image width changed · Issue #2863 · mapeditor/tiled · GitHub (or rather, the issue is about something else, but a Tile Atlas tileset type is a likely part of the solution.)