Bunny catch coin background bug

Why does the “winning background” flash after each time the coin touches the bunny? And it does not “stick” when the score is greater than 10??

This appears to be a remix of someone else’s project.

Looking at the code, it appears that when the bunny touches the coin, if the score is less than 10, it shows the “game background” (which is immediately drawn over again), otherwise it shows the “winning background”.

2 Likes

A few more details for the previous answer.
The draw loop runs 30 times per second, so every time your draw loop begins it will make the background white and then go through the rest of the loop.

The way you have it now, it only checks the score when the coin is colliding. So it checks it that time through and draws it once, goes back to the top and makes the background white, thus it looks like it flashes. If you move the score checking after the collision check instead of inside that if statement, it will be drawn each time through instead of only when the coin and bunny collide.

If you want the score to show all the time you need that code to be after you draw the background.

Hope this helps and let us know if you have any other questions.
CeciliaZ

2 Likes

Ha! We knew it was soemthing like that but just couldn’t get the changes right. Makes sense now! Thanks!

2 Likes