Test out this code BOIZ

This commit is contained in:
KahootChampion
2019-02-25 20:20:11 -07:00
parent 1295d625fb
commit 581bee7bfe
2 changed files with 2 additions and 6 deletions

View File

@@ -213,6 +213,7 @@ public class Player {
public void gameOver(){ public void gameOver(){
System.out.flush(); System.out.flush();
System.out.println("Game over"); System.out.println("Game over");
System.exit(0);
} }
public boolean playAgain(){ public boolean playAgain(){

View File

@@ -322,9 +322,7 @@ public class ShipWarfare {
return true; return true;
} else if (exitValue == 2) { } else if (exitValue == 2) {
player.gameOver(); player.gameOver();
if(player.playAgain()){
setPlayer(new Player());
}
return true; return true;
} else if (exitValue == 3) { } else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP()); System.out.printf("We made it out at %d%% ship status!\n", player.getHP());
@@ -453,9 +451,6 @@ public class ShipWarfare {
return true; return true;
} else if (exitValue == 2) { } else if (exitValue == 2) {
player.gameOver(); player.gameOver();
if(player.playAgain()){
setPlayer(new Player());
}
return true; return true;
} else if (exitValue == 3) { } else if (exitValue == 3) {
System.out.printf("We made it out at %d%% ship status!\n", player.getHP()); System.out.printf("We made it out at %d%% ship status!\n", player.getHP());