To find out what Global and Instance mode are you can refer to the documentation.
Why would we want to use Instance mode.
Because with Instance mode we can create separate instances, one for each screen of the game (Main menu, game screen, score screen, and any other screen that might be useful in the future).
Makes the code more modular and easy to manage.
It is easier to give a style to the screens because everything is a p5 canvas, so we can use their functions.
Switching between the instances is achieved by using the show() method of each p5 element.
What is needed to get there
Refactor the sketch.js file
Create a single index.html where each canvas is in its own div element.
To find out what Global and Instance mode are you can refer to the documentation.
Why would we want to use Instance mode.
show()
method of each p5 element.What is needed to get there
sketch.js
fileindex.html
where each canvas is in its owndiv
element.