Multiple "levels" in game help

I have a student trying to create multiple levels or multiple screens in her game. She is wanting the background to switch when play1.x>475 and then again when play1.x>450 to swich to a different background. However, it is not triggering both backgrounds. I am thinking it is because are we are saying basically two of the same types of things and then asking it to do two different things. I guess, I’m wondering if there is a way to make it work. She is wanting it to appear like 3 different levels.

When I looked at the game, and moved play1, a new background showed up at 450 and then another one when that sprite got to 475. Were you able to figure it out or do I not understand what you are trying to do?

There are three levels that appear when play1 moves to the right. Is there something else you wanted to happen with the backgrounds?

It starts with the orangish background, flashes the second background, and then stays at the third background. We are wanting it to stay at the second background then when the bunny moves across the screen again it moves to the third screen.

I think this will make happen what you want. I remixed it and if I understand correctly what you are trying to do, this could be a solution.

If you have code that keeps the second background and resets the bunny. It will always check to see if it’s at 450 and reset it at that point and never make it to 475. The way it is now it gets to 450 and shows the second background until it gets to 475 and the third background shows. Where you have the code in line 57 to start it on the left again.

If you stop pressing the down key when the background changes at play1.x gets to 450 it will stay at that background until you press the down key again and play1 gets to 475.

A way to make scenes change each time play1.x gets to the right edge would be to set all backgrounds.visible=0 and then use a counter that starts at 0. If sprite.x=450 then add one to the counter, check if counter=1 then make first background visible and move sprite back to where you want it. As it moves across again, when sprite.x=450, counter is increased, If counter=2 then make second background visible and other background.visible=0.

Was this what you were trying to do? Hope this helps and let me know if it worked or you have other questions.

This won’t answer your question, but you should tell your student to have a level variable to keep track of the level the player is currently on. It’s a very helpful technique, you can redesign everything every level! It’s also easier to work with.