From 7e9ba348b2b667207c04821ad5140b69f3efa8bd Mon Sep 17 00:00:00 2001 From: KahootChampion Date: Mon, 25 Mar 2019 13:35:11 -0600 Subject: [PATCH] Ship Warfare "dang it" issue fixed --- src/ShipWarfareGUI.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java index 496f86f..4169c65 100644 --- a/src/ShipWarfareGUI.java +++ b/src/ShipWarfareGUI.java @@ -266,6 +266,8 @@ public class ShipWarfareGUI extends Player { } if (gunFrustration == true) { gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", getGuns())); + playerShoots(getGuns()+1); + } else { gunsLeftOrTaken.setText(String.format("We still have %d guns left", getGuns())); } @@ -309,7 +311,7 @@ public class ShipWarfareGUI extends Player { /** * Player attacks enemy ships in an animation */ - public void playerShoots() { + public void playerShoots(int amountOfShots) { userAttacks=true; shotsFired.setFromX(0); shotsFired.setFromY(0); @@ -317,7 +319,7 @@ public class ShipWarfareGUI extends Player { shotsFired.setToY(endY); shotsFired.setDuration(Duration.seconds(0.5)); if(getGuns()>0) { - shotsFired.setCycleCount(getGuns()); + shotsFired.setCycleCount(amountOfShots); } else{ shotsFired.setCycleCount(0); @@ -617,7 +619,7 @@ public class ShipWarfareGUI extends Player { } - playerShoots(); + playerShoots(getGuns()); shotsFired.setOnFinished(new EventHandler() { @Override