Hi there,
I am still new to GDevelop JS API and have some questions about it.
My goal is to react to a simple mouse click on an object.
I have a solution but is this best practice or did I miss some function?
var btn_restart = runtimeScene.getObjects("btn_restart")[0];
if(runtimeScene.getGame().getInputManager().isMouseButtonPressed(0) && runtimeScene.getOnceTriggers().triggerOnce() ) {
console.log("Left Mouse Click")
// Check if mouse is over button
if(btn_restart.isCollidingWithPoint(runtimeScene.getGame().getInputManager().getMouseX(), runtimeScene.getGame().getInputManager().getMouseY())) {
console.log("Button Restart clicked")
}
}