Lesson 17 Project Help

Please help…
Student has created a project similar to the flower example. She has 4 “virus” images that the use will click on. She has created a virus count variable at the top of her code. She is adding to that count each time the mouse is pressed over the virus. She has a conditional to trigger the present to be visible if the virus count is >= to 4, however it is not working properly…the present is appearing way to soon.

Any suggestions that I am overlooking?

Thank you!

Hello @sarah.dudley!

What is happening here is that although the click makes the sprite become invisible, it is still there and holding down the mouse button, even for a few milliseconds triggers the code and increases the count multiple times.

The easiest fix might be to also move the x and or y position of the sprite to be off the screen right after it is clicked. This should cause the collision to no longer exist and the count will only increase by one.

Hope this helps!


I fixed all the code but it should give you an idea how to correct this problem next time!

Source => Game Lab - Code.org

Yep. Another way to do it.


What a great project. It looks good!