2
\$\begingroup\$

In my tilemap-based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other.

Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear: I don't want to store custom data with each tile type, but with individual instances of one tile type.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You can do this by using an Object Layer:

  • You can use Tile Objects to place your switches and doors, so that you can set custom properties on them to define which switch is connected to which door.
  • If you still want to use a Tile Layer for placing the switches and doors, then you could place plain rectangular objects on the Object Layer and match them to the tiles by their location.

In both cases, you could use the recently added unique object IDs to refer to the other objects, or you can set names on them and use that as a reference, which could be easier to understand.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for your quick answer! Noticing that you are the main developer, might I suggest to consider implementing a more straightforward approach to this (allowing custom data for each tile)? Would definitvle be useful in this otherwise great tool - I still discover new features every day which seem to solve exacly the problems I was having \$\endgroup\$
    – jalgames
    Commented Mar 12, 2015 at 21:58
  • \$\begingroup\$ I don't think it's an easy feature to do properly, and I was hesitant to add it because of the overlap in functionality with the object layers. Yet, you can find an incomplete patch that adds the basic functionality at github.com/bjorn/tiled/issues/31 \$\endgroup\$ Commented Mar 13, 2015 at 20:55
  • 1
    \$\begingroup\$ I have the same problem sadly. The object layer isn't that useful because in my game you can move tile by tile while object layer uses pixel precision. Alright I can calculate the tile from the pixels but thats a big hack because it can span over multiple tiles while I only need one at a time. I need to set properties for each tile individually for example is tile walkable, what monsters spawn on that tile, how fast each monster respawn, what object available on that tile (multiple trees, shops etc on one tile). I'm doing a text based online rpg with a small map. \$\endgroup\$ Commented Jul 23, 2015 at 12:33
  • \$\begingroup\$ Yeah, it would be really useful to have custom data on tiles. Trying to add a door tile as an object is so much harder than adding it as a tile with a property like 'locked' or 'key'. \$\endgroup\$
    – Richard
    Commented Apr 12, 2021 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .