In some video games the scenes are changing as the main character is exiting the screen. This was a popular technique in older days due to technical difficulties of creating a scrolling screen.
However, the technique is very efficient and can be utilized even today.
This program shows a simple way of switching the scenes. All you need to do is to imagine a cool game based on this effect.
The JavaScript source code of this program can be found here. To run it, you need to import it in the codeguppy.com online editor. Alternatively, you can use the source code in your p5.js sketches (advanced use).
To see the code running, check the online playground at https://codeguppy.com/code.html?t=cycle_scenes
Please check codeguppy.com for many other fun JavaScript programs and games for beginners. To stay up to date with CodeGuppy development please follow @codeguppy on Twitter.