Just thought Iâd mention a new feature that is coming in 2.2 - Config Files
A config file is simply just a single JSON object like below. It can have any values in it you want.
{
"type":"Body",
"bodyType":"static",
"bounce":0.6,
"points": ["pointA","pointB","pointC","pointD"]
}
In Tiled you can then assign this to anything that can have a property simply by giving it a property of âconfigFileâ with the value set to the location of the above file, so for this I set it to a Tile in a TileSet like so:
âconfigFileâ - âphysicsBody.jsonâ
The path is relative to the Resource folder however if you want to have it in the Documents folder (for instance a new object definition has been downloaded by the player etc) you can set it like this:
âconfigFileâ - âdocuments|physicsBody.jsonâ
All the elements of the json file (which can have any extension) will be copied over to the object as properties so can be accessed in the usual way.
I know this seems a bit of a step back from using a GUI however it can still be helpful, for instance if you wanted a bunch of separate Tiles to have the same properties, rather than setting them all up in Tiled for each one (and changing them all every time you want something different) you could now just create a config file for them and just assign the file to all the Tiles. It also allows a programmer to create complex object definitions that a designer could just hook up without having to know anything about what is actually happening underneath.
Hopefully itâs helpful to someone.
I forgot to say, that this means you will require âJson.luaâ in your project. It is freely available but Iâm not sure if I would be allowed to actually bundle it with the purchase of Lime so will contact the authors before everything goes on sale.
Also, a Tiled item canât have duplicate properties with the same name so for now an item can only have one config file assigned to it, Iâm thinking of allowing nested config files so that you could set up a single file that then links multiple files, like this:
{
"configFile":"physicsBody.json",
"configFile":"playerObject.json",
"configFile":"otherStuff.json"
}
[import]uid: 5833 topic_id: 4422 reply_id: 17816[/import]