I’m using Tiled to create maps and i have a bunch of objects, I’m using map.createFromObjects() to generate objects and, properties such as position, size, rotation are being copied, but not the ID nor the GID
Here is an object in Tiled with its properties
As you can see it has ID, Name, Type, X, Y, etc… the GID is not shown by Tiled but it’s in the json
Here’s how i generate the map
And when i do a console log
I can clearly see all objects with all the correct data (id, name, type, rotation, etc)
I think that’s intended. It means all custom properties are copied onto the Game Object (if a matching property exists) or onto its data store (otherwise).
In my example I have a button that when it gets pressed it should trigger a platform to move, I have the ID of the platform because it copies the custom property, but now I need to find that platform to apply some movement, but I cant do this because my Platform class doesn’t receive it’s corresponding ID
Well, thanks for the answers, what i will do is define a custom property and let createFromObjects() handle it, because now i realize that i might need to reference various objects and i cant do that having only one id
The createFromObjects() function is really nice for some things, but if you want access to the information you put in your question I would try the getObjectLayer() function. It essentially mirrors the JSON for that object layer and you can iterate through the objects in the resulting data structure to get information that isn’t coming along with your createFromObjects().