Error with Code for Lesson 17 - Interactive Card

Link to the project or level: Game Lab -
What I expect to happen: After clicking 8 or more times, the coin should not repeatedly be seen on the screen. Also, after clicking on each of the backgrounds, they should disappear.
What actually happens: After clicking 8 or more times, the coin is showing up repeatedly on the screen. When clicking on the backgrounds, nothing happens.
What I’ve tried: We have tried moving drawSprites to different locations in the draw loop. We have checked through the code several times.

Thank you!

The trick is to use background("white") - or any colour you choose - right above the drawSprites() function in the draw loop. Once the canvas has been clicked 8 times, the backgrounds will disappear and the text and emoji will show.

@letti42 has given you some good advice that does work, although if you want each background to disappear when you click on it, you will need to add some code for that like you have added for making the balls disappear.

Also, right now, clicking anywhere 8 times will make the animation occur. If you wanted it to be more precise and only occur when each of the balls and each of the backgrounds had been removed, you’d probably have to count when those items disappear rather than counting clicks.

Hopefully this helps you with the next steps!


1 Like