Reputation: 34288
The function createFromObjects
has the gid
as the second argument to be passed. The argument is used in the createFromObjects
function in the following way:
createFromObjects: function (name, gid, key, frame, exists, autoCull, group, CustomClass, adjustY) {
// ...
for (var i = 0, len = this.objects[name].length; i < len; i++)
{
if (this.objects[name][i].gid === gid)
{
// ...
}
}
}
This expects the objects in the layer name
to contain the field gid
which points to the gid
of the sprite to use.
However, the JSON file exported from Tiled does not contain any field gid
.
Tiled only allows one to add custom properties to the Objects and there is no gid
field present on the object to edit.
How can I include an gid
in the exported JSON?
Upvotes: 0
Views: 542
Reputation: 34288
The answer to the question can be found here.
Indeed you can't set the gid of an object after you have placed it.
You place these tile objects using the "Insert Tile Objects" tool, after selecting the tile in your tileset.
Upvotes: 1