Score is adding, but the first number isn't disappearing...they're just going on top of one another

My student has the score working, it’s inside the draw function. The project begins with a score of zero, and when the first “if” statement is clicked on, the score adds one, which is correct, but the zero doesn’t disappear. And then the second “if statement” happens and she gets the score to show “2” but now it’s on top of the one which is on top of the zero…and so on…

Any ideas on how we can correct this?

Hi @jmarsman, can you have the student share the project and then send us a link to look at? It’s hard to troubleshoot if we can’t look at exactly what is happening, but we are happy to look at it if you can send us the shared link.



Thank you Mike. Here is the link…and while you’re at it :wink: can you maybe also look at why the dog bones are not disappearing on the mouse click - she has it set to visable = false but it’s still showing, and then she tried to set the x and y positions to just be off the grid, but they’re still showing…thanks,

The issues you are bringing up are related… Because the background was created outside of the draw loop, it is only being drawn one time. So, when you update the score, the new score is being drawn over the top of the old score. Same thing is happening with the bones. When you make them invisible, they technically are no longer visible according to the program, but since the background isn’t being redrawn, they are still there. so the solution is to move all of the background drawing blocks inside the draw loop where they will be redrawn each time the draw loop is executed.

That may cause one or two small unintended consequences, but that’s the fun of debugging and I’m sure this will give your student a good start to solving the issue!


Thank you Mike!!! That was it :smile: