Output Options: x,y,w,h?

I have used tiled before with a few different projects, but most of the time I can just output it and import it, so I have very little knowledge of how it is outputted.

However, I have a pretty old project and it renders sprites using x,y,w,h from a json file.
It is possible to export tiled files into an x,y,w,h format? The project isn’t really worth rewriting at this point, but it would be still nice to update the maps and keep it somewhat relevant.

You can write custom output formats in C++, Python and since recently, JavaScript. The last option should be the easiest to set up, you just need to install a recent development snapshot instead of the Tiled 1.2.4 release.

See the documentation for how to define your custom format. Producing JSON in JavaScript is particularly straight-forward.

Thanks for the quick reply. It looks like it has a lot of documentation.

Hey man, I thought I would let you know… well you probably know, but for others who come across this question. The format already exists… sort of.

.gmx is an option to export.

It gives you x,y,w,h,xo(sprite x),yo(sprite y)

I just converted it to json and that is all I needed!

Thanks for the help, I did actually get the script running as well, but just converting the gmx is easier in my opinion.

2 Likes

It’s great to hear that you go the script running, but of course if converting the GameMaker export is easier then that’s a good way to go! I had totally forgotten that GameMaker: Studio 1.4 uses pretty much exactly this format to define a map (or “room”, as they call it). Indeed this avoids potentially having to deal with a bunch of logic for special cases which are already handled by this export plugin.

Yeah it make it easy, for about any language. Xml -> json. Worst case you could loop through it and remove stuff you don’t need, but it’s easy to explain in my notes, so in 6 months I wouldn’t have to figure it out again.