50 likes | 209 Views
Java. Finish command line guessing game, then…. GUI Guessing Game. GuessingGame. GuessingGameUI extends javax.swing.JFrame. GuessingGame. target: int gameOver : boolean statusMsg : String. - game: GuessingGame. target: int gameOver : boolean. + GuessingGameUI ()
E N D
Java • Finish command line guessing game, then…
GUI Guessing Game GuessingGame GuessingGameUIextends javax.swing.JFrame GuessingGame • target: int • gameOver: boolean • statusMsg: String - game: GuessingGame • target: int • gameOver: boolean + GuessingGameUI() + btnNewGameActionPerformed(evt: java.awt.event.ActionEvent): void + btnGuessActionPerformed(evt: java.awt.event.ActionEvent): void + processGuess(guess: int) + getMsg(): String + isGameOver(): boolean + newGame(): - setTarget(): void GuessingGameApp <no fields> + main(args: String): void
Important Points • Remember that your GuessingGame class doesn't just run from start to finish, it responds to the requests from the UI • Note that there is no main loop! • Get your parameters and return types correct for you GuessingGame methods • The UI passes information to the GuessingGame and updates the UI on the basis of what it gets back
Extending the game • Ask the user for confirmation if they start a new game before the old game was finished • Allow the user to set the upper bound for the random target • Keep a count of the number of tries and display it on the GUI • Keep a list of high scores (requires file handling, which you have not been taught but which is on the blog…) • Other ideas? Please share…