Getting template data into map JSON file

I am exporting my map in JSON file and reading it into my monogame project with a nested class, which is used to render and manipulate the map.

I am now putting some finish touches on, in which I need multiple tiles to act as one object. My method is to create a template that is the size of these multi[le tiles and layer them on top of the stamps on my map, and I set a custom property on the template that is my source rectangle on the sprite sheet. This allows me to render the whole object off the sprite sheet as one texture in my engine.

My current issue is when I export my object layer looks like this:

"objects":[
                {
                 "id":10,
                 "template":"..\/maps\/tree.tx",
                 "x":424.25,
                 "y":40.25
                }, 

I see in the documentation it is possible to export the template itself as JSON but cant figure out how to do that. Even better if I can export that JSON into the map JSON itself. Are either of these actions possible?

I don’t work with templates so I don’t know if there’s an easy way to convert a TX template into a TJ template (it’s definitely possible, but it might be rather annoying to replace all the references).

If you want to include the template data directly in your maps, that’s possible: Enable the “Detach templates” export option in Edit > Preferences. Note that this only applies to exports, so your working maps get to keep using templates.

1 Like

Great thank you! Looking forward to getting that sorted.