arcade
arcade copied to clipboard
Adding the object id to TiledObject
Enhancement request:
What should be added/changed?
The TiledObject class currently doesn't have a way to get the ID it corresponds to in the Tiled map editor. An attribute should be added to allow access to that information.
What would it help with?
When a tile has an object in it's custom properties, arcade shows that property as a string of the object's id. Having a way to access the objects' ids would allow to identify which object is referenced in a tile's custom property.
@Mattlau04 are you able to provide an example of what ID's you mean? As far as I'm aware, object IDs and tile properties aren't related in any way, so I'm not 100% sure what the request is.
If it is for object IDs from Object Layers then it should be fairly easy to add, anything to do with Tiled's custom property system will be a much bigger lift, as we don't currently support that system at all.
I believe I've an example of such file. I can't upload it here, but the file is there: https://nuage03.apps.education.fr/index.php/s/XyEcxoNYdTYzdXr The object bar has a properties that link to the object foo.
Tiled use the ID of the object for this, but in python, I cannot use it. For example, I can do (with my example):
map = arcade.load_tilemap("..\..\..\Downloads\exemple-id-in-properties.tmx"
id_near = map.object_lists['objects'][1].properties['near']
id_near
will be '1'
, but I see no way to know that, in tiled, the id of map.object_lists['objects'][0] is 1.
@Cleptomania Wasn't this already implemented?