Sprite not appear or moving when background changes

I have a student that is having the aforementioned issues. I have recreated the issue and I can’t seem to find the solution.

**What I expect to happen: They have a “front” screen that tells the player to hit space bar to enter the game. They are using a sprite background. When you hit space - it goes to the next screen. The player sprite is not visible on the first screen. When you hit space it should become visible on the next screen - which also is a sprite background - and then you should be able to control the movement of the sprite. I have a scaled down version of the code that I’m playing with.
**What actually happens: When space is pressed down - it switches to the next screen. However, the sprite does not appear.
**What I’ve tried: I have added variables in order to make the screens appear and the cat should also appear when the variable changes. I have moved the background around, moved the sprite around before and after the background - even put the code under the “drawsprites.” On occasion - the cat sprite will appear on the second screen - however, it cannot be controlled to move. Or - depending on where I put it - the cat blinks briefly and then doesn’t show up at all on the second screen.

I’ve been futzing with this for two days and I’m stumped. Please help.

roconnel,

Thanks for the question! When you create a new background inside the draw loop, it is actually creating a new sprite and since it is the most recently created the sprite, it will be on top.

Probably the easiest fix would be to avoid creating a 2nd background sprite and instead just assign a new animation (costume) to the existing background sprite. This way, it will still be behind the cat sprite and it also simplifies the code, so you only have one background sprite and then just change the animation depending on the level.

If you still can’t get it to work, let us know. When I tried that on my end, it worked right away.

good luck!

Mike