Skip to content
Snippets Groups Projects
Commit a595e261 authored by Arfa Butt's avatar Arfa Butt
Browse files

Include time in game over message

parent 2a806db3
No related branches found
No related tags found
No related merge requests found
......@@ -209,7 +209,7 @@ System.out.println(prefer.getPreferredSize());
* @brief display message for game over
* @param whichplayer is the indicator for the player
*/
public void gameOver(int whichplayer){
public void gameOver(int whichplayer, double time){
/**
* - If the computer wins, display winning message for the computer
......@@ -217,11 +217,13 @@ System.out.println(prefer.getPreferredSize());
*/
if(whichplayer==0){
JFrame overFrame = new JFrame("Game Over");
JOptionPane.showMessageDialog(overFrame, "The game is over! The computer wins!");
JOptionPane.showMessageDialog(overFrame, "The game is over! The computer wins!\n"
+ " Your time = " + time);
}
else{
JFrame overFrame = new JFrame("Game Over");
JOptionPane.showMessageDialog(overFrame, "The game is over! The player wins!");
JOptionPane.showMessageDialog(overFrame, "The game is over! The player wins!\n"
+ " Your time = " + time);
}
gameFrame.setVisible(false);
welcome.setVisible(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment