0
\$\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
\$\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\$
  • \$\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 Mar 12 '15 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\$ – Thorbjørn Lindeijer Mar 13 '15 at 20:55
  • \$\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\$ – Lakatos Gyula Jul 23 '15 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.