We are about to switch to a new forum software. Until then we have removed the registration on this forum.
how do you make the title page of a game, as well as the exit code for it.
Can you be more specific? Are you intending to build a game where a loading screen is used and after winning / losing the game ends and goes back to the loading screen?
I suggest that you search on 'modes' from the main website. A mode might be a splash screen, game play, high score table then you just switch modes.
or search state
asimes, a game where a loading screen is used and after winning
Yes searching on state would be better.
I post an example where the mode is called state (and the states have names)
// // states final int stateGame = 0; // consts final int statePause = 1; int state = stateGame; // current // ------------------------------------------------- void setup() { // init (runs only once) size(800, 600); } // func void draw() { // runs on and on switch (state) { case stateGame: // Game handleStateGame(); break; case statePause: // Pause handleStatePause(); break; default: // error println("Error number 939; unknown state : " + state + "."); exit(); break; } // switch // } // func // functions for states - called from draw() void handleStateGame() { // Game background(11); fill(244, 3, 3); // red text ("This is the Game....", 210, 313); // noStroke(); fill(255, 2, 2) ; rect(100, 100, 100, 100); fill(255, 2, 255) ; rect(300, 100, 100, 100); } // func void handleStatePause() { // Pause background(255); fill(244, 3, 3); // red text ("Pause.... " + " ... ", 210, 313); text ("Hit p to start Game", 210, 385); } // func // ---------------------------------------- // keyboard input void keyPressed() { switch (state) { case stateGame: // Game keyPressedForStateGame(); break; case statePause: // Pause keyPressedForStatePause(); break; default: // error println("Error number 1039; unknown state : " + state + "."); exit(); break; } // switch } // func // ---- void keyPressedForStateGame() { if (key == CODED) { if (keyCode == UP) { // } else if (keyCode == DOWN) { // } if (keyCode == LEFT) { // } else if (keyCode == RIGHT) { // } else { // do nothing } // else } // if (key == CODED) { else { // not CODED ---------------------- if (key == 'p') { // Pause state = statePause; } else { // do nothing } // else } // else not CODED } // func void keyPressedForStatePause() { if (key == CODED) { if (keyCode == UP) { // } else if (keyCode == DOWN) { // none } if (keyCode == LEFT) { // } else if (keyCode == RIGHT) { // } else { // do nothing } // else } // if (key == CODED) { else { // not CODED ---------------------- if (key == 'p') { // state = stateGame; } else { // do nothing } // else } // else not CODED } // func // ------------------------------------------------------- // Mouse input void mousePressed() { // switch (state) { case stateGame: // Game mousePressedForStateGame(); break; case statePause: // Pause mousePressedForStatePause(); break; default: // error println("Error number 1139; unknown state : " + state + "."); exit(); break; } // switch } // func void mousePressedForStateGame() { // color c1 = get(mouseX, mouseY); if (c1 == color(255, 2, 2)) { println ("left"); text ("left", 13, 13); } else if (c1 == color(255, 2, 255)) { println ("right"); text ("right", 13, 13); } // } // func void mousePressedForStatePause() { // } // func // =================================
To newcomers in this forum: read attentively these instructions
Remember to choose a category when posting.
Answers
Can you be more specific? Are you intending to build a game where a loading screen is used and after winning / losing the game ends and goes back to the loading screen?
I suggest that you search on 'modes' from the main website. A mode might be a splash screen, game play, high score table then you just switch modes.
or search state
asimes, a game where a loading screen is used and after winning
Yes searching on state would be better.
I post an example where the mode is called state (and the states have names)
To newcomers in this forum: read attentively these instructions
Remember to choose a category when posting.