I would like to store a bit of data each non-empty tile in one of my tilemap layers. Ideally, a key-value table.
Is there a trick to do so?
I would like to store a bit of data each non-empty tile in one of my tilemap layers. Ideally, a key-value table.
Is there a trick to do so?
No, I’m afraid not. This is something that we have discussed, but it’s only a ticket in our backlog for now. My recommendation is to use an external tool such as Tiled and then export the tilemap as json (or maybe even better as a Lua table if that is supported) and load that into Defold and then use tilemap.set_tile() (see this thread: Tilemap creation in script (SOLVED)) to populate the tilemap and at the same time store some extra meta-data in a Lua table for easy access in your game code.
Also, check this video of forum user @AJirenius where he shows how to do this: https://www.livecoding.tv/setthebet/videos/qV3Dn-shmup-game-integrate-tiled-in-defold
Finally, Tiled now also has support for export to Defold tilemaps. I wonder if it also supports export of additional meta-data to a Lua table or json file? Does anyone know?