Hi Dyson - tried this (i.e. addObjectDrawListener(name, listener)) but could not seem to get it working. I couldn’t find an example in the samples that I could see. Then I noted it’s description is “…which monitors the Tiled Object draw functions for the creation of an object with the matching name…”. So does this mean it would work for the “Insert Tile” on an object layer but not the “Insert Rectangle” on an object layer?
With the goal of trying to support placing images (albeit via putting them into tiles first) on the level in Tiled and being able to place, rotate, resize them…noting that Tiled doesn’t support resizing images…then if I want to use the Tiled object layer’s “Add Rectangle” object as the basis for placing them (not ideal as they are not rendered in Tiled) and then programmatically create the image myself, then what would be the best approach in MTE for this?
I’m thinking ideally you should use MTE’s ability to create/remove the images as required, i.e. the whole point of MTE. So this would mean one would require a generic listener perhaps in MTE to pick up all of the object creation & deletions. Rather than passing an object name it would perhaps be best to keep the listener more open/generic, So perhaps:
local function objectLayerListenerFunction(event) local phase = event.phase -- either "create", or "dispose" local target = event.target -- to give you a handle to the object print(target.type) -- prints Object Type from Tiled print(target.myCustomPropertyFieldNameFromTiled) -- Can get all the tiled name properties -- then could if (event.phase == "create") then -- create your image else -- dispose the image end end mte.addObjectLayerListener(objectLayerListenerFunction)
Would adding such an “addObjectLayerListener” be possible? Is there another way of doing this already I’m missing?