ShipWarfare javaDocs completed
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import javafx.animation.*;
|
import javafx.animation.*;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.event.Event;
|
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@@ -16,10 +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.io.FileNotFoundException;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,11 +27,7 @@ import java.util.Random;
|
|||||||
public class AnimationTesting extends Player {
|
public class AnimationTesting extends Player {
|
||||||
|
|
||||||
private ShipWarfareGUI ship;
|
private ShipWarfareGUI ship;
|
||||||
private HBox usAgainstEnemyDivisor;
|
|
||||||
private BorderPane centeringUserShipPane;
|
|
||||||
private Circle cannon;
|
private Circle cannon;
|
||||||
private BorderPane centeringLittyShipPane;
|
|
||||||
private BorderPane encompassingPane;
|
|
||||||
private VBox buttonBox;
|
private VBox buttonBox;
|
||||||
private HBox fightRunBox;
|
private HBox fightRunBox;
|
||||||
private Button fightButton;
|
private Button fightButton;
|
||||||
@@ -170,7 +161,11 @@ public class AnimationTesting extends Player {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 {
|
public boolean destroyLittyShipsOrEscape(Stage stage) throws Exception {
|
||||||
cannon.setLayoutX(beginningX);
|
cannon.setLayoutX(beginningX);
|
||||||
cannon.setLayoutY(beginningY);
|
cannon.setLayoutY(beginningY);
|
||||||
@@ -311,6 +306,9 @@ public class AnimationTesting extends Player {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Player attacks enemy ships in an animation
|
||||||
|
*/
|
||||||
public void playerShoots() {
|
public void playerShoots() {
|
||||||
userAttacks=true;
|
userAttacks=true;
|
||||||
shotsFired.setFromX(0);
|
shotsFired.setFromX(0);
|
||||||
@@ -330,6 +328,10 @@ public class AnimationTesting extends Player {
|
|||||||
shotsFired.play();
|
shotsFired.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ships attack player ship back in an animation
|
||||||
|
*/
|
||||||
|
|
||||||
public void shipsRetaliate(){
|
public void shipsRetaliate(){
|
||||||
cannon.setVisible(true);
|
cannon.setVisible(true);
|
||||||
enemyShots.setFromX(270);
|
enemyShots.setFromX(270);
|
||||||
@@ -342,6 +344,11 @@ public class AnimationTesting extends Player {
|
|||||||
enemyShots.play();
|
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) {
|
public void setVisibilitiesAndTransition(Stage stage) {
|
||||||
completeWipe();
|
completeWipe();
|
||||||
continueButton.setVisible(true);
|
continueButton.setVisible(true);
|
||||||
@@ -360,6 +367,11 @@ public class AnimationTesting extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 startShipAnimation(Stage primaryStage) throws Exception {
|
public void startShipAnimation(Stage primaryStage) throws Exception {
|
||||||
setNumOfLittyShips(numOfShips());
|
setNumOfLittyShips(numOfShips());
|
||||||
|
|
||||||
@@ -501,15 +513,17 @@ public class AnimationTesting extends Player {
|
|||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
continueButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
|
/**
|
||||||
|
* Continue Button, engages in run logic and graphical interface
|
||||||
|
* @param event, once button is clicked, executes graphical information
|
||||||
|
*/
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
shotsFired.stop();
|
shotsFired.stop();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches to Taipan Shop scene
|
* Switches to Taipan Shop scene
|
||||||
* @param event, once button is clicked, executes graphical information
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
TaipanShopGUI shop = new TaipanShopGUI(getPlayer());
|
||||||
shop.initializeShop(primaryStage);
|
shop.initializeShop(primaryStage);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
@@ -520,6 +534,10 @@ public class AnimationTesting extends Player {
|
|||||||
//Flee
|
//Flee
|
||||||
runButton.setOnAction(new EventHandler<ActionEvent>() {
|
runButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
|
/**
|
||||||
|
* Run Button, engages in run logic and graphical interface
|
||||||
|
* @param event, once button is clicked, executes graphical information
|
||||||
|
*/
|
||||||
public void handle(ActionEvent event) {
|
public void handle(ActionEvent event) {
|
||||||
report.setVisible(true);
|
report.setVisible(true);
|
||||||
title.setVisible(true);
|
title.setVisible(true);
|
||||||
@@ -589,14 +607,14 @@ public class AnimationTesting extends Player {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
playerShoots();
|
playerShoots();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
|
shotsFired.setOnFinished(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@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) {
|
public void handle(ActionEvent event) {
|
||||||
shotsFired.stop();
|
shotsFired.stop();
|
||||||
if(!winOrLose) {
|
if(!winOrLose) {
|
||||||
@@ -612,6 +630,10 @@ public class AnimationTesting extends Player {
|
|||||||
}
|
}
|
||||||
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
|
enemyShots.setOnFinished(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@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) {
|
public void handle(ActionEvent event) {
|
||||||
fightButton.setVisible(true);
|
fightButton.setVisible(true);
|
||||||
runButton.setVisible(true);
|
runButton.setVisible(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user