From 61f88c0a861294eb2e74dc50b17499a3c3c0f431 Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Mon, 25 Mar 2019 11:06:39 -0600
Subject: [PATCH] Completed ShipWarfareGUI
---
.idea/workspace.xml | 436 +++++++++++++++----------
src/ShipWarfareGUI.java | 668 +++++++++++++++++++++++++++++++++++++++
src/saves/playerSave.txt | Bin 365 -> 383 bytes
3 files changed, 944 insertions(+), 160 deletions(-)
create mode 100644 src/ShipWarfareGUI.java
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a75c649..5d8ad58 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,10 +1,9 @@
-
-
+
-
+
@@ -20,8 +19,8 @@
-
-
+
+
@@ -30,20 +29,44 @@
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -54,41 +77,42 @@
- initialize
- gif
- shipsRemainingGIF
- initial
- initializeS
- ship
- imageView
- 20
- shipsAttackingGif.set
- continueto
- setprefwidth
- setvisible(false)
- chooseF
- setPadd
- setvisible
- vbox.se
- attacking
- would
- choosefightorrun.set
- setpre
+ .setvis
+ durati
+ setText
+ setVisi
+ continue
+ userSh
+ continueButton
+ continueButton.setV
+ .setText
+ .setVisi
+ taipanSH
+ runButton.setOn
+ runButton.se
+ setVis
+ counter
+ stage
run
- setvisi
- fightand
- shipWarfa
- imageview
- image
- shipsAttack
- shipsAttackingOr
- ships
- shipw
+ flee
+ runFrom
+ report
+ report.setVisible
+ playerSh
+ fightButton
+ PlayerSh
+ andT
+ dest
+ playerShoots
+ shotsFired
+ duration
+ shop()
HP
@@ -100,6 +124,12 @@
attackImage
shipsAttacking
shipsApproachingGIF
+ centeringLittyShipPane
+ numOfLittyShips
+ startingLitty
+ littyShip
+ whenfinished
+ whenFinished
@@ -116,11 +146,12 @@
-
+
+
@@ -135,7 +166,6 @@
-
@@ -148,18 +178,25 @@
+
+
+
+
+
+
+
-
+
@@ -169,6 +206,7 @@
+
@@ -185,15 +223,15 @@
-
-
+
+
-
-
+
+
@@ -222,18 +260,18 @@
-
+
+
-
@@ -288,63 +326,17 @@
-
-
-
- 1550458470138
-
-
-
- 1550458470138
-
-
- 1550540282400
-
-
-
- 1550540282400
-
-
- 1550540820542
-
-
-
- 1550540820542
-
-
- 1550541406597
-
-
-
- 1550541406597
-
-
- 1550541751914
-
-
-
- 1550541751914
-
-
- 1550543764970
-
-
-
- 1550543764971
-
-
- 1550575512841
-
-
-
- 1550575512841
-
-
- 1550623749854
-
-
-
- 1550623749854
+
+
+
+
+
+
+
+
+
+
+
1550628232136
@@ -591,17 +583,115 @@
1553061205759
-
+
+ 1553124112040
+
+
+
+ 1553124112040
+
+
+ 1553193939606
+
+
+
+ 1553193939606
+
+
+ 1553387960582
+
+
+
+ 1553387960582
+
+
+ 1553389067767
+
+
+
+ 1553389067767
+
+
+ 1553390319733
+
+
+
+ 1553390319734
+
+
+ 1553390384762
+
+
+
+ 1553390384762
+
+
+ 1553400771267
+
+
+
+ 1553400771272
+
+
+ 1553476072174
+
+
+
+ 1553476072175
+
+
+ 1553478643204
+
+
+
+ 1553478643204
+
+
+ 1553482933744
+
+
+
+ 1553482933744
+
+
+ 1553484357669
+
+
+
+ 1553484357670
+
+
+ 1553485725159
+
+
+
+ 1553485725159
+
+
+ 1553486334208
+
+
+
+ 1553486334209
+
+
+ 1553533396273
+
+
+
+ 1553533396273
+
+
-
+
-
+
@@ -610,7 +700,7 @@
-
+
@@ -698,21 +788,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -723,7 +799,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -794,13 +884,6 @@
-
-
-
-
-
-
-
@@ -815,28 +898,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -844,23 +906,77 @@
-
+
+
-
+
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
new file mode 100644
index 0000000..f1839fa
--- /dev/null
+++ b/src/ShipWarfareGUI.java
@@ -0,0 +1,668 @@
+import javafx.animation.*;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.geometry.Insets;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Pane;
+import javafx.scene.layout.VBox;
+import javafx.scene.shape.Circle;
+import javafx.stage.Stage;
+import javafx.util.Duration;
+import java.io.FileInputStream;
+import java.util.Random;
+
+/**
+ * 2019-03-10 (Edited on 2019-03-23)
+ * Author: Haris Muhammad
+ * ShipWarfareGUI class, Generates and utilizes ships which the user can attack or run from
+ */
+
+
+public class ShipWarfareGUI extends Player {
+
+ private ShipWarfareGUI ship;
+ private Circle cannon;
+ private VBox buttonBox;
+ private HBox fightRunBox;
+ private Button fightButton;
+ private Button runButton;
+ private Button continueButton;
+ private VBox labelBox;
+ private Label title;
+ private Label HPLeft;
+ private Label gunsLeftOrTaken;
+ private Label runAwayOrLeft;
+ private Label shipsRemaining;
+ private Label report;
+
+ private boolean winOrLose= false;
+
+
+ private int counter1;
+ private int timeCounter;
+
+ private int numOfLittyShips = 0;
+ private boolean userAttacks = true;
+ private int startingLittyShips = 0;
+ private int howMuchRun = 0;
+ private int counter = 0;
+ private String pirateName = "Liu Yen";
+
+ private int beginningX = 150;
+ private int beginningY = 245;
+
+ private int endX = 350;
+ private int endY = 90;
+
+ private TranslateTransition shotsFired = new TranslateTransition();
+ private TranslateTransition enemyShots = new TranslateTransition();
+
+ /**
+ * constructor; only runs when a Player object is provided. The constructor is fully encapsulated.
+ *
+ * @param player is a Player object that will be copied and the player instance variable is set to the copy.
+ */
+ public ShipWarfareGUI(Player player) {
+ Player playerDummy = new Player(player);
+ setPlayer(playerDummy);
+ }
+
+ /**
+ * The number of ships that attack is based on the amount of money one has on hand
+ *
+ * @return the number of ships which will attack
+ */
+ public int numOfShips() {
+
+ int numOfShipsAttacking = 0;
+ Random randomValue = new Random();
+
+ if (getMoney() <= 100000) {
+ //Minimum one ship will attack, maximum 20
+ numOfShipsAttacking = randomValue.nextInt(20) + 1;
+ } else if (getMoney() <= 200000) {
+ //Minimum 30 Ships will attack, maximum 70
+ numOfShipsAttacking = randomValue.nextInt(40) + 31;
+ } else if (getMoney() <= 500000) {
+ //Minimum 50 ships will attack, maximum 140
+ numOfShipsAttacking = randomValue.nextInt(90) + 51;
+ } else if (getMoney() >= 1000000) {
+ //Minimum 100 ships will attack, maximum 300 ships
+ numOfShipsAttacking = randomValue.nextInt(200) + 101;
+ }
+
+ return numOfShipsAttacking;
+
+ }
+
+ /**
+ * setter method that takes in an integer as an argument
+ *
+ * @param numOfLittyShips the number of ships to be used in the peasant fleet attack
+ */
+ public void setNumOfLittyShips(int numOfLittyShips) {
+ counter1++;
+ this.numOfLittyShips = numOfLittyShips;
+ if (counter1 == 1) {
+ startingLittyShips = numOfLittyShips;
+ }
+
+ }
+
+ /**
+ * One in two chance of running away
+ *
+ * @return true if the user is allowed to run, false if not, the "default" is false
+ */
+ public boolean runFromShips() {
+ userAttacks = false;
+ Random randomValue = new Random();
+ int runSuccessChance = randomValue.nextInt(10) + 1;
+ if (runSuccessChance == 2) {
+ return true;
+ } else if (runSuccessChance == 1) {
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * Sets most of the labels invisible except for the "fight or run" label
+ */
+ public void wipe() {
+ title.setVisible(false);
+ runAwayOrLeft.setVisible(false);
+ shipsRemaining.setVisible(false);
+ HPLeft.setVisible(false);
+ gunsLeftOrTaken.setVisible(false);
+
+
+ }
+
+ /**
+ * Sets most of the labels invisible including the fight or run label
+ */
+ public void completeWipe() {
+ title.setVisible(false);
+ runAwayOrLeft.setVisible(false);
+ shipsRemaining.setVisible(false);
+ HPLeft.setVisible(false);
+ gunsLeftOrTaken.setVisible(false);
+ report.setVisible(false);
+ }
+
+
+
+
+ /**
+ * The user faces off against the litty ships and either prevails, dies, or runs away
+ *
+ * @return true if the user wins, loses, or flees, it returns false otherwise
+ */
+ public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
+ cannon.setLayoutX(beginningX);
+ cannon.setLayoutY(beginningY);
+ int calculateLoot = 0;
+ int chanceOfEnemyRun = 0;
+ int hitCounter = 0;
+ int missCounter = 0;
+ boolean gunFrustration = false;
+
+
+
+
+
+
+ Random randomValue = new Random();
+ int exitValue = 0;
+ //Player volley
+ //while (exitValue == 0) {
+ if (getGuns() > 0) {
+
+ for (int j = 0; j < getGuns(); j++) {
+ if (userAttacks == true) {
+
+ int hitOrMiss = randomValue.nextInt(2) + 1;
+ if (hitOrMiss == 2) {
+ numOfLittyShips--;
+ if (numOfLittyShips <= 0) {
+ exitValue = 1;
+ //break;
+ }
+ hitCounter++;
+
+
+ } else {
+ missCounter++;
+
+ }
+
+
+
+ } else {
+ //continue;
+ }
+ }
+ if (userAttacks == true) {
+ report.setText(String.format("Report: Ships hit: %d, Shots missed: %d", hitCounter, missCounter));
+ }
+ } else {
+ report.setText("We don't have any guns!!!");
+
+ }
+
+
+ if (numOfLittyShips <= 0) {
+ exitValue = 1;
+ //break;
+ }
+ if (getGuns() > 0) {
+ chanceOfEnemyRun = randomValue.nextInt(2) + 1;
+ if (chanceOfEnemyRun == 2) {
+ howMuchRun = randomValue.nextInt(15) + 1;
+ if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
+
+
+ setNumOfLittyShips(numOfLittyShips - howMuchRun);
+ if (userAttacks == true) {
+ if (howMuchRun > 0) {
+ runAwayOrLeft.setText(String.format("Cowards! %d ships ran away %s! ", howMuchRun, getName()));
+
+ //runAwayOrLeft.setVisible(true);
+ }
+
+ } else {
+ report.setText((String.format("Escaped %d of them %s!", howMuchRun, getName())));
+ }
+
+ }
+ }
+ }
+
+ shipsRemaining.setText(String.format("%d ships remaining and they look angry!", numOfLittyShips));
+ //Computer volley
+ int takeGunChance = randomValue.nextInt(4) + 1;
+ if (takeGunChance == 1 && getGuns() > 0) {
+ setGuns(getGuns() - 1);
+ gunFrustration = true;
+ } else {
+ if (numOfLittyShips > 0) {
+ int HPTaken = randomValue.nextInt(10);
+ setHP(getHP() - (HPTaken));
+
+
+ }
+ }
+ if (getHP() <= 0) {
+ exitValue = 2;
+ //break;
+ }
+ if (gunFrustration == true) {
+ gunsLeftOrTaken.setText(String.format("Dang it! We only have %d guns left", getGuns()));
+ } else {
+ gunsLeftOrTaken.setText(String.format("We still have %d guns left", getGuns()));
+ }
+
+ HPLeft.setText(String.format("EEK, our current ship status is %d%% ", getHP()));
+ if (userAttacks == false) {
+ userAttacks = true;
+ }
+
+
+ if (exitValue == 1) {
+ wipe();
+ calculateLoot = (startingLittyShips * 100) + randomValue.nextInt(startingLittyShips) * 200;
+ setMoney(getMoney() + calculateLoot);
+ report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
+ continueButton.setVisible(true);
+ completeWipe();
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
+ continueButton.setDefaultButton(true);
+ return true;
+ } else if (exitValue == 2) {
+ GameEndGUI gameEndGUI = new GameEndGUI(getPlayer());
+ gameEndGUI.initializeGameEndGUI(stage);
+ stage.show();
+ return true;
+ } else if (exitValue == 3) {
+ report.setText(String.format("We made it out at %d%% ship status!", getHP()));
+
+ continueButton.setVisible(true);
+ completeWipe();
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
+ continueButton.setDefaultButton(true);
+ return true;
+ }
+ return false;
+
+ }
+
+ /**
+ * Player attacks enemy ships in an animation
+ */
+ public void playerShoots() {
+ userAttacks=true;
+ shotsFired.setFromX(0);
+ shotsFired.setFromY(0);
+ shotsFired.setToX(endX);
+ shotsFired.setToY(endY);
+ shotsFired.setDuration(Duration.seconds(0.5));
+ if(getGuns()>0) {
+ shotsFired.setCycleCount(getGuns());
+ }
+ else{
+ shotsFired.setCycleCount(0);
+ shotsFired.stop();
+ cannon.setVisible(false);
+ }
+ shotsFired.setNode(cannon);
+ shotsFired.play();
+ }
+
+ /**
+ * Ships attack player ship back in an animation
+ */
+
+ public void shipsRetaliate(){
+ cannon.setVisible(true);
+ enemyShots.setFromX(270);
+ enemyShots.setFromY(0);
+ enemyShots.setToX(-30);
+ enemyShots.setToY(90);
+ enemyShots.setDuration(Duration.seconds(0.5));
+ enemyShots.setCycleCount(1);
+ enemyShots.setNode(cannon);
+ enemyShots.play();
+ }
+
+ /**
+ * Sets most buttons to being invisble and switches to TaipanShop scene
+ *
+ * @param stage stage the user incorporates when they utilize the GUI
+ */
+ public void setVisibilitiesAndTransition(Stage stage) {
+ completeWipe();
+ continueButton.setVisible(true);
+ continueButton.setDefaultButton(true);
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
+ /**
+ * Switches to Taipan Shop scene
+ * @param event, once button is clicked, executes graphical information
+ */
+ continueButton.setOnAction(event -> {
+ TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
+ shop.initializeShop(stage);
+ stage.show();
+ });
+ }
+
+
+ /**
+ * Generaties ships and deploys logic for the shipwarfare
+ * @param primaryStage sets up the stage to whcih the GUI may be based around
+ * @throws Exception in case of interruptions withing the graphical interface
+ */
+ public void initializeShip(Stage primaryStage) throws Exception {
+ setNumOfLittyShips(numOfShips());
+
+ Pane root = new Pane();
+ HBox usAgainstEnemyDivisor;
+ BorderPane centeringUserShipPane = new BorderPane();
+ Circle cannon;
+ BorderPane centeringLittyShipPane = new BorderPane();
+ BorderPane encompassingPane = new BorderPane();
+ usAgainstEnemyDivisor = new HBox();
+ cannon = new Circle();
+ this.cannon = cannon;
+
+
+
+ cannon.setVisible(false);
+
+ buttonBox = new VBox();
+ fightRunBox = new HBox();
+ fightButton = new Button();
+ runButton = new Button();
+ continueButton = new Button();
+ labelBox = new VBox();
+ title = new Label();
+ HPLeft = new Label();
+ gunsLeftOrTaken = new Label();
+ runAwayOrLeft = new Label();
+ shipsRemaining = new Label();
+ report = new Label();
+
+ title.setText(String.format("%d ships from Liu Yuen's Fleet are attacking, Would you like to fight or run?", numOfLittyShips));
+
+
+ fightButton.setText("Fight");
+ runButton.setText("Run");
+ continueButton.setText("Continue");
+
+ fightButton.setVisible(true);
+ runButton.setVisible(true);
+ continueButton.setVisible(false);
+
+
+ encompassingPane.setAlignment(labelBox, javafx.geometry.Pos.CENTER);
+ labelBox.setAlignment(javafx.geometry.Pos.CENTER);
+ labelBox.setPrefHeight(41.0);
+ labelBox.setPrefWidth(600.0);
+ labelBox.setSpacing(20.0);
+
+ labelBox.setPadding(new Insets(10.0, 0.0, 0.0, 0.0));
+
+ encompassingPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
+ buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
+
+
+ fightRunBox.setAlignment(javafx.geometry.Pos.CENTER);
+ fightRunBox.setPrefHeight(100.0);
+ fightRunBox.setPrefWidth(200.0);
+ fightRunBox.setSpacing(10.0);
+
+ VBox.setMargin(continueButton, new Insets(0.0, 0.0, 20.0, 0.0));
+
+
+ root.getChildren().add(cannon);
+
+ encompassingPane.setPrefHeight(480);
+ encompassingPane.setPrefWidth(600);
+
+
+ usAgainstEnemyDivisor.setPrefHeight(0.0);
+ usAgainstEnemyDivisor.setPrefWidth(600.0);
+
+ centeringUserShipPane.setPrefHeight(200.0);
+ centeringUserShipPane.setPrefWidth(200.0);
+
+ Image ourShip = new Image(new FileInputStream("src/images/ourShip.png"));
+ Image enemyShip = new Image(new FileInputStream("src/images/enemyShip.png"));
+
+
+ //Setting the image view
+ ImageView userShip = new ImageView(ourShip);
+ ImageView littyShip = new ImageView(enemyShip);
+
+ BorderPane.setAlignment(userShip, javafx.geometry.Pos.CENTER);
+ userShip.setFitHeight(150.0);
+ userShip.setFitWidth(248.0);
+ userShip.setPickOnBounds(true);
+ userShip.setPreserveRatio(true);
+ centeringUserShipPane.setCenter(userShip);
+
+ BorderPane.setAlignment(buttonBox, javafx.geometry.Pos.CENTER);
+ buttonBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
+
+ usAgainstEnemyDivisor.setTranslateY(-20.0);
+
+ cannon.setRadius(10.0);
+ cannon.setStroke(javafx.scene.paint.Color.BLACK);
+ cannon.setStrokeType(javafx.scene.shape.StrokeType.INSIDE);
+ centeringUserShipPane.setRight(cannon);
+
+ centeringLittyShipPane.setPrefHeight(200.0);
+ centeringLittyShipPane.setPrefWidth(200.0);
+ centeringLittyShipPane.setOpaqueInsets(new Insets(0.0));
+ HBox.setMargin(centeringLittyShipPane, new Insets(0.0, 0.0, 0.0, 200.0));
+
+ encompassingPane.setAlignment(littyShip, javafx.geometry.Pos.CENTER);
+ littyShip.setFitHeight(165.0);
+ littyShip.setFitWidth(180.0);
+ littyShip.setPickOnBounds(true);
+ littyShip.setPreserveRatio(true);
+ encompassingPane.setMargin(littyShip, new Insets(0.0, 0.0, 20.0, 0.0));
+ centeringLittyShipPane.setCenter(littyShip);
+
+ usAgainstEnemyDivisor.getChildren().add(centeringUserShipPane);
+ usAgainstEnemyDivisor.getChildren().add(centeringLittyShipPane);
+ fightRunBox.getChildren().add(fightButton);
+ fightRunBox.getChildren().add(continueButton);
+ fightRunBox.getChildren().add(runButton);
+ buttonBox.getChildren().add(fightRunBox);
+ labelBox.getChildren().add(title);
+ labelBox.getChildren().add(HPLeft);
+ labelBox.getChildren().add(gunsLeftOrTaken);
+ labelBox.getChildren().add(runAwayOrLeft);
+ labelBox.getChildren().add(shipsRemaining);
+ labelBox.getChildren().add(report);
+
+ encompassingPane.setTop(labelBox);
+ encompassingPane.setCenter(usAgainstEnemyDivisor);
+
+ encompassingPane.setBottom(buttonBox);
+
+ root.getChildren().addAll(encompassingPane, cannon);
+
+ Scene scene = new Scene(root, 600, 480);
+ root.getStylesheets().add("styleguide.css");
+
+ primaryStage.setResizable(false);
+
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ continueButton.setOnAction(new EventHandler() {
+ @Override
+ /**
+ * Continue Button, engages in run logic and graphical interface
+ * @param event, once button is clicked, executes graphical information
+ */
+ public void handle(ActionEvent event) {
+ shotsFired.stop();
+
+ /**
+ * Switches to Taipan Shop scene
+ */
+
+ TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
+ shop.initializeShop(primaryStage);
+ primaryStage.show();
+
+ }
+ });
+
+ //Flee
+ runButton.setOnAction(new EventHandler() {
+ @Override
+ /**
+ * Run Button, engages in run logic and graphical interface
+ * @param event, once button is clicked, executes graphical information
+ */
+ public void handle(ActionEvent event) {
+ report.setVisible(true);
+ title.setVisible(true);
+ shipsRemaining.setVisible(true);
+ gunsLeftOrTaken.setVisible(true);
+
+ title.setText("Ayy captain we will try to run!");
+ report.setText("Epic");
+ counter++;
+
+ if (runFromShips() == false) {
+ report.setText(("Couldn't run away"));
+ try {
+ winOrLose= destroyLittyShipsOrEscape(primaryStage);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if(winOrLose==true){
+ report.setVisible(true);
+ title.setVisible(true);
+ shipsRemaining.setVisible(true);
+ gunsLeftOrTaken.setVisible(true);
+
+ }
+ } else {
+
+ report.setText("Phew! Got away safely");
+ setVisibilitiesAndTransition(primaryStage);
+
+
+ }
+
+ }
+ });
+
+ //Fight
+ fightButton.setOnAction(new EventHandler() {
+
+ @Override
+ /**
+ * Fight Button, engages in fight logic and graphical interface
+ * @param event, once button is clicked, executes graphical information
+ */
+ public void handle(ActionEvent event) {
+ report.setVisible(false);
+ runAwayOrLeft.setVisible(false);
+ shipsRemaining.setVisible(false);
+ HPLeft.setVisible(false);
+ gunsLeftOrTaken.setVisible(false);
+ fightButton.setVisible(false);
+ runButton.setVisible(false);
+
+ try {
+ winOrLose= destroyLittyShipsOrEscape(primaryStage);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ counter++;
+
+ cannon.setVisible(true);
+ cannon.setLayoutX(beginningX);
+ cannon.setLayoutY(beginningY);
+
+ if (counter >= 1) {
+ title.setVisible(false);
+
+ }
+
+ playerShoots();
+
+ shotsFired.setOnFinished(new EventHandler() {
+ @Override
+ /**
+ * When the user is completed their volley this information will be accessed
+ * @param event, once the shots fired transition is completed, execute graphical information
+ */
+ public void handle(ActionEvent event) {
+ shotsFired.stop();
+ if(!winOrLose) {
+ shipsRetaliate();
+ }
+ else{
+ report.setVisible(true);
+ continueButton.setVisible(true);
+ usAgainstEnemyDivisor.setVisible(false);
+ cannon.setVisible(false);
+ shotsFired.stop();
+
+ }
+ enemyShots.setOnFinished(new EventHandler() {
+ @Override
+ /**
+ * When the user is completed their volley, this information will be accessed
+ * @param event, once the enemy shots transition is completed, execute graphical information
+ */
+ public void handle(ActionEvent event) {
+ fightButton.setVisible(true);
+ runButton.setVisible(true);
+ report.setVisible(true);
+ cannon.setVisible(false);
+ runAwayOrLeft.setVisible(true);
+ gunsLeftOrTaken.setVisible(true);
+ shipsRemaining.setVisible(true);
+ HPLeft.setVisible(true);
+ gunsLeftOrTaken.setVisible(true);
+
+ if(winOrLose==true){
+ usAgainstEnemyDivisor.setVisible(false);
+ }
+
+ }
+ });
+
+ }
+
+ });
+
+
+ }
+ });
+
+ }
+}
+
+
+
+
+
diff --git a/src/saves/playerSave.txt b/src/saves/playerSave.txt
index b73d1cebef04134771199ee83da256bb0fe5ec26..9ffee6cd2652ef77c8b3f6db4bb11966e1071fce 100644
GIT binary patch
delta 143
zcmaFM^q)y`&07Z6;vxpNfSkn2)S}4?RSwi>H~wT|5T7V1BN)ZNmsnDgn4F!NmmZvv
zSx`LD^kGCK0|cZnLK!wt8bomdF)I)=0WnaX%>hUQfn5Wb0?JiD8E~qEfh{C4vmh}K
E0KwcDumAu6
delta 110
zcmey*^p;6-&07Z6;vxpNfSkn2)FKtfj9VP)9E+J4#3oA0Omut5smlNXza|?p3R`ml
kIm|%J1jLLC48k1{Nyh~cnn5xJ%79ZP3~V8ZnFWb?08(xfIsgCw