| Reference | Downloads | Github

Halt everything while awaiting mouse is pressed in


Is there any equivalent function of event.waitKeys but for the mouse, and more specifically for the isPressedIn function? I would like to halt everything until a left click is pressed inside a specific area (a pic).

I’ve been relying on a while loop approach which draws the stimulus and then check if the mouse has been pressed inside the pic. The problem with this approach is that sometimes I’ve to click several time the image for the click to be detected.

Is there a better approach?

If you put a small, comprehensible sample of your code here (properly formatted by putting a line of three backticks (`) above and below your code of course :wink:), you could get better feedback.

And FYI, if there’s nothing changing while you’re waiting, you don’t have to continually call .draw() in your loop, if that’s what you’re doing. You could call draw once and the image will remain there. Maybe a slowdown due to this could account for the lost clicks?