WIP ShipWarFareLogic GUI made it so that I can start form scratch at combining logic with GUI
This commit is contained in:
@@ -14,6 +14,7 @@ import javafx.scene.layout.VBox;
|
|||||||
import javafx.scene.shape.Circle;
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@@ -45,12 +46,7 @@ public class ShipWarfareGUI extends Player {
|
|||||||
private boolean winOrLose = false;
|
private boolean winOrLose = false;
|
||||||
|
|
||||||
|
|
||||||
private int counter1;
|
|
||||||
private int timeCounter;
|
|
||||||
|
|
||||||
private int numOfLittyShips = 0;
|
|
||||||
private boolean userAttacks = true;
|
private boolean userAttacks = true;
|
||||||
private int startingLittyShips = 0;
|
|
||||||
private int howMuchRun = 0;
|
private int howMuchRun = 0;
|
||||||
private int counter = 0;
|
private int counter = 0;
|
||||||
private String pirateName = "Liu Yen";
|
private String pirateName = "Liu Yen";
|
||||||
@@ -75,8 +71,6 @@ public class ShipWarfareGUI extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets most of the labels invisible except for the "fight or run" label
|
* Sets most of the labels invisible except for the "fight or run" label
|
||||||
*/
|
*/
|
||||||
@@ -103,16 +97,12 @@ public class ShipWarfareGUI extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user faces off against the litty ships and either prevails, dies, or runs away
|
* 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
|
* @return true if the user wins, loses, or flees, it returns false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
|
public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
|
||||||
ShipWarfareGUILogic logic = new ShipWarfareGUILogic (getPlayer());
|
|
||||||
|
|
||||||
cannon.setLayoutX(beginningX);
|
cannon.setLayoutX(beginningX);
|
||||||
cannon.setLayoutY(beginningY);
|
cannon.setLayoutY(beginningY);
|
||||||
int calculateLoot = 0;
|
int calculateLoot = 0;
|
||||||
@@ -122,9 +112,6 @@ public class ShipWarfareGUI extends Player {
|
|||||||
boolean gunFrustration = false;
|
boolean gunFrustration = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
runAwayOrLeft.setText("No ships ran away");
|
runAwayOrLeft.setText("No ships ran away");
|
||||||
Random randomValue = new Random();
|
Random randomValue = new Random();
|
||||||
int exitValue = 0;
|
int exitValue = 0;
|
||||||
@@ -151,7 +138,6 @@ public class ShipWarfareGUI extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//continue;
|
//continue;
|
||||||
}
|
}
|
||||||
@@ -176,7 +162,6 @@ public class ShipWarfareGUI extends Player {
|
|||||||
if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
|
if (howMuchRun != 0 && howMuchRun < numOfLittyShips) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setNumOfLittyShips(numOfLittyShips - howMuchRun);
|
setNumOfLittyShips(numOfLittyShips - howMuchRun);
|
||||||
if (userAttacks == true) {
|
if (userAttacks == true) {
|
||||||
if (howMuchRun > 0) {
|
if (howMuchRun > 0) {
|
||||||
@@ -266,8 +251,7 @@ public class ShipWarfareGUI extends Player {
|
|||||||
shotsFired.setDuration(Duration.seconds(0.5));
|
shotsFired.setDuration(Duration.seconds(0.5));
|
||||||
if (getGuns() > 0) {
|
if (getGuns() > 0) {
|
||||||
shotsFired.setCycleCount(amountOfShots);
|
shotsFired.setCycleCount(amountOfShots);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
shotsFired.setCycleCount(0);
|
shotsFired.setCycleCount(0);
|
||||||
shotsFired.stop();
|
shotsFired.stop();
|
||||||
cannon.setVisible(false);
|
cannon.setVisible(false);
|
||||||
@@ -317,6 +301,7 @@ public class ShipWarfareGUI extends Player {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generaties ships and deploys logic for the shipwarfare
|
* Generaties ships and deploys logic for the shipwarfare
|
||||||
|
*
|
||||||
* @param primaryStage sets up the stage to whcih the GUI may be based around
|
* @param primaryStage sets up the stage to whcih the GUI may be based around
|
||||||
* @throws Exception in case of interruptions withing the graphical interface
|
* @throws Exception in case of interruptions withing the graphical interface
|
||||||
*/
|
*/
|
||||||
@@ -334,7 +319,6 @@ public class ShipWarfareGUI extends Player {
|
|||||||
this.cannon = cannon;
|
this.cannon = cannon;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cannon.setVisible(false);
|
cannon.setVisible(false);
|
||||||
|
|
||||||
buttonBox = new VBox();
|
buttonBox = new VBox();
|
||||||
@@ -577,8 +561,7 @@ public class ShipWarfareGUI extends Player {
|
|||||||
shotsFired.stop();
|
shotsFired.stop();
|
||||||
if (!winOrLose) {
|
if (!winOrLose) {
|
||||||
shipsRetaliate();
|
shipsRetaliate();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
report.setVisible(true);
|
report.setVisible(true);
|
||||||
continueButton.setVisible(true);
|
continueButton.setVisible(true);
|
||||||
usAgainstEnemyDivisor.setVisible(false);
|
usAgainstEnemyDivisor.setVisible(false);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user