Initial interface of a game

Hello everyone!
I’m planning a game and I was wondering how it was done once the design was finished to create the home screen with a minimum of player interactivity: I was thinking of a “welcome to the game” and the pulsating classes to be written with “start playing” and maybe some other button with “rules” written where it then connects to a screen where I explain the rules of the game.
Can any of you direct me to the interactive part?

Thanks for anyone who wants to help me! :slight_smile:

1 Like

Google state in this forum (it means screen you want to show)

Before setup () :
int state=0;

In draw():

Have a

if(state==0) {
// show initial screen 
background (0);
text("Welcome!", 300,300);
...
} 
else if(state==1){
//show game screen 
background (0);
...
}
else if(state==2){
// show rules screen 
background (0);
text("The rules", 30,30);
...
}
....

When state is 0 show the welcome screen in the if clause above

When it’s 1 show the game

When it’s 2 show rules

etc.

(Nothing in draw() should be allowed outside the if clause)

Have the same if clause structure in void mousePressed() and void keyPressed()
so only the mouse pressings for the current state are registered.


Buttons

Go website examples buttons to see buttons

2 Likes

grazie per la risposta! Proverò a capire come applicarla, molto gentile!

2 Likes

Puoi leggere di più sul concetto di “state machine” e su P.rocessing, a.k.a. “finite state machine”.