[Solved] Recreate 'The cursor/touch is on' object in Javascript

Hello, i’m hoping somebody could help, i’m trying to recreate the ‘The cursor/touch is on’ condition but with javascript i’ve got as far as selecting the object I would like this applied to (done that using the UI) and i’ve popped in the following to target the object however i’m not sure where to go from here.

objects.forEach(object =>  {

const testBtn = object;

/*
But here where is I fall flat, what would be the condition used to apply 'The cursor/touch is on' to this object?
*/

})

Any help at all would be great.

Many thanks.

The way I get around this is by mixing and matching GDevelop events with Javascript. I’ll use GDevelop events where possible and then follow up with javascript where it’s needed. Is it important that you detect cursor/touch in the javascript?

if(gdjs.evtTools.input._cursorIsOnObject(object, runtimeScene))
EDIT: the above is a bad idea. Prefer this method:
if(object.cursorOnObject(runtimeScene))

1 Like

Brill, many thanks both.