CSD 21 -22 Unit 3 Lesson 17 Bubble 2 Example uses a block mousePressedOver(sprite)

Game Lab Question.: We learned about the mousePressedOver(sprite) from an exemplar in Lesson 17 of CSD Unit 3. The students really liked this block but when the student tried to recreate what was done with the flowers and the vase showing up sometimes the counter would go up by more then one. The only way we can get the action to only take place once on a click is to move the sprite that we are clicking on immediately.

I would like to know if there is a better work around.

Here is an example of the student trying to use the Mouse PressedOver (sprite). Code.org (Code.org) But when you click on the present the tap count goes up by more than one.


That can definitely happen if the click is held even a fraction of a second too long. Another workaround might be to use the && block in the math and create a double condition.

In the same group of blocks as the “mousePressedOver(sprite)” button, there is also a “mouseIsOver” button which detects if the mouse is hovering over a specific sprite.

There is also a button that detects if the left mouse button was pressed.

A combination of those two happening at the same time would probably solve your problem.

Let us know if that works or if we can help further!