I want to provide a coordinate like (100, 100) and check to see if an object with the platform behavior is there.
I can’t seem to find a straight forward way to achieve this.
Well this javascript block seems to do the job, in case anyone else runs into this.
const platformMgr = gdjs.PlatformObjectsManager.getManager(runtimeScene);
var object = new gdjs.RuntimeObject(runtimeScene, {name: "obj1", type: "", behaviors: []});
object.getWidth = function() { return 1; };
object.getHeight = function() { return 1; };
object.setPosition(eventsFunctionContext.getArgument("X") , eventsFunctionContext.getArgument("Y"));
let results = [];
platformMgr.getAllPlatformsAround(object, 0, results);
if (results.length === 0)
{
eventsFunctionContext.returnValue = -1;
return;
}
eventsFunctionContext.returnValue = results[0]._platformType;
1 Like
there’s 2 conditions called called compare object x and compare object y that can check that