Test out this code BOIZ
This commit is contained in:
@@ -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(){
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user