Lesson 26 Using the Game Design Process - Changing Sprite Backgrounds

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level:

What I expect to happen:
When player score reaches 10 sprite background 1 changes to sprite background 2.
What actually happens:
When background hits 10, sprite background 1 does not change and sprites smear across screen instead of moving across screen.

What I’ve tried:
Making sprite visible & not visible at certain points in the code
Moving sprites within the functions and outside of the function

@haley.hardwick,

Good morning! When the score is below 10, the bg1 function makes bg2 invisible. Then, when the score reaches 10, the bg2 function makes the bg1 invisible, but bg2 is still invisible, so now, since both sprites are invisible, the sprites drag across the last bg1 that was drawn. Making it invisible doesn’t delete old versions of it, so the old one is there, a new one isn’t drawn and the animals and cupcake drag.

The solution is to make sure that the bg2 function makes the bg1 invisible (which is already does), but that it also makes the bg2 visible as well.

Hopefully this all makes sense!

good luck!

Mike

Thank you so much, I think I figured it out.

1 Like