We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am making a game in Processing. One part is the home screen, a second part is the actual game, and the third part is going to be a game over screen. I can make it so the home screen goes to the actual game by using a boolean, but how would I display the game over screen, with everything else not shown?
Answers
Stop using a boolean. Instead, number your states 0 (for the home page), 1 (the game), and 2 (game over screen). Then use an integer to remember which state you're in instead of a boolean. Change you if statements to check the value of that integer instead of just checking if your boolean is true or false.
I find using numbers a bit cryptic so usually define constants at the top of the code for each state and then use those names throughout: