Fun MouseY Dilemma!

Skip to first unread message

Zach Grafton

May 2, 2018, 5:00:38 PM5/2/18
to Processing.js
Hi all, first time begging for programming advice from strangers EVER, but I'm sure we'll all be family soon.

I'm doing one of the Coding Train challenges - Minesweeper, but I've hit a wall where when I click on a box in-game, the mouse seems to click on the box above it (in Chrome and IE). I assume this is related to MouseY? Anyone know how to fix this?

At this point, my code is identical to the original code here -

Thanks in advance!

Lee Brunjes

May 2, 2018, 5:15:23 PM5/2/18
So, typically this is caused by an off by one error in your code. The above linked code seems good on first glance.

I haven't done a bunch of p5.js work but my guess is that their mouseY is probably correct.

The easy debug step is to draw a rectangle at mouseX, mouseY as well as the coords. If it shows up not under the mouse something bad is happening. If it shows up right check your logic in the cell.js contains method and the mouse event loops.

Hope that helps a bit.

You received this message because you are subscribed to the Google Groups "Processing.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Zach Grafton

May 2, 2018, 8:39:01 PM5/2/18
to Processing.js
Thank you so much! I had a tiny error in my contains method and you pointed me right toward it. You're a hero and the world needs more of you.
Reply all
Reply to author
0 new messages