Issue with Number of clicks registering/counting correctly

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level: (
What I expect to happen: The student created a variable to keep track of click counts. When the click count gets to 4 new sprites are to appear.
What actually happens: We expect when we click with the mouse it only registers 1 click and not an inconsistent number of clicks.
What I’ve tried: We tried to use console.log to watch the clicks and each time we click on the same sprite it registers a different number of clicks. I also tried clearing cache.

I thought that it would register one click also but because it runs it so fast that isn’t the case.

The way the mousePressedOver works combined with the default Framerate (30 times per second for the draw loop), the program will cycle through multiple times during each click and add to counter each time. The way to work around that is to slow down the frame rate, so each click only gets counted once.

The example in the documentation for the mousePressedOver command shows an example that slows down the WorldframeRate to 1. When I remixed yours and played around with it, a WorldframeRate of 5 worked well.

This is a screenshot of the example given in the documentation

To see all this information and get to the documentation for each block, hover over a block and it should have a box pop up that gives you the option to see examples. like this

When you click on “see examples” you should get a screen like this


Good information from @CeciliaZ !

If you don’t want to change the frame rate to slow things down, there is another solution. You may need to change the order of some of your blocks, but here’s some basic pseudocode.

When mousePressedOver object, add a click.
Now, move the object (change the x or y number to be something completely off the screen (greater than 400).

This causes the mousePressedOver command to no longer work and the click only increases by one because the object is no longer there.

Good luck!


1 Like