Guest User

Untitled

a guest
Jun 23rd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1.     /**
  2.      * Quits the game
  3.      */
  4.     private void quit()
  5.     {
  6.         //First confirm the player is sure they want to quit.
  7.         Printer.outputText("Are you sure you want to quit? (y/n)");
  8.  
  9.         //If yes
  10.         if (parser.getNextInput().equalsIgnoreCase("Y"))
  11.         {
  12.             //Ask if they want to save the game
  13.             Printer.outputText("Would you like to save the game first? (y/n)");
  14.             if (parser.getNextInput().equalsIgnoreCase("Y"))
  15.             {
  16.                 //If yes, call the Save() method
  17.                 save();
  18.             }
  19.             //Else, it's okay to terminate the game
  20.             world.endGame();
  21.         }
  22.     }
Add Comment
Please, Sign In to add comment