From 4d09891665ec84d549905d479ff00e00f759afb1 Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 23:03:30 -0600
Subject: [PATCH 1/5] Added to my javadocs a bit
---
.idea/workspace.xml | 43 ++++++++++++++++++-------------
src/ShipWarfareGUI.java | 56 ++++++++++++++++++++++-------------------
2 files changed, 55 insertions(+), 44 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b6e4175..5bcdea5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -19,8 +19,8 @@
-
-
+
+
@@ -40,7 +40,7 @@
-
+
@@ -172,7 +172,7 @@
-
+
@@ -287,7 +287,7 @@
-
+ 1550458470138
@@ -527,11 +527,18 @@
1552279406066
-
+
+ 1552280311398
+
+
+
+ 1552280311399
+
+
-
+
@@ -634,7 +641,6 @@
-
@@ -659,7 +665,8 @@
-
+
+
@@ -746,13 +753,6 @@
-
-
-
-
-
-
-
@@ -774,10 +774,17 @@
+
+
+
+
+
+
+
-
-
+
+
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
index f028417..4ed6c83 100644
--- a/src/ShipWarfareGUI.java
+++ b/src/ShipWarfareGUI.java
@@ -9,6 +9,7 @@ import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
+
import java.util.Random;
public class ShipWarfareGUI {
@@ -32,21 +33,15 @@ public class ShipWarfareGUI {
private Button continueButton;
-
- /*
- /**
- * 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){
+ /**
+ * 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);
this.player = playerDummy;
}
- //public static void main(String args[]) {
- // launch(args);
- //}
private int numOfPeasantShips = 0;
private int numOfLittyShips = 0;
@@ -59,6 +54,7 @@ public class ShipWarfareGUI {
/**
* setter method for player
+ *
* @param player object of the class Player
*/
public void setPlayer(Player player) {
@@ -68,6 +64,7 @@ public class ShipWarfareGUI {
/**
* getter method for obtaining a player object.
+ *
* @return returns player object
*/
public Player getPlayer() {
@@ -77,12 +74,13 @@ public class ShipWarfareGUI {
/**
* setter method that takes in an integer as an argument
+ *
* @param numOfPeasantShips the number of ships to be used in the peasant fleet attack
*/
- public void setNumOfPeasantShips(int numOfPeasantShips){
+ public void setNumOfPeasantShips(int numOfPeasantShips) {
counter1++;
this.numOfPeasantShips = numOfPeasantShips;
- if(counter1==1) {
+ if (counter1 == 1) {
startingPeasantShips = numOfPeasantShips;
}
@@ -90,6 +88,7 @@ public class ShipWarfareGUI {
/**
* 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() {
@@ -117,6 +116,7 @@ public class ShipWarfareGUI {
/**
* 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() {
@@ -134,7 +134,7 @@ public class ShipWarfareGUI {
/**
* Sets most of the labels invisible except for the "fight or run" label
*/
- public void wipe(){
+ public void wipe() {
title.setVisible(false);
runAwayOrLeft.setVisible(false);
shipsRemaining.setVisible(false);
@@ -160,6 +160,7 @@ public class ShipWarfareGUI {
/**
* The user faces off against the peasant ships and either prevails, dies, or runs away
+ *
* @return true if the user wins, loses, or flees, it returns false otherwise
* @throws Exception in case of errors due to the delay
*/
@@ -208,7 +209,8 @@ public class ShipWarfareGUI {
} else {
//continue;
}
- }if(userAttacks==true) {
+ }
+ if (userAttacks == true) {
report.setText(String.format("Report: Ships hit: %d, Shots missed: %d", hitCounter, missCounter));
}
} else {
@@ -236,7 +238,7 @@ public class ShipWarfareGUI {
}
} else {
- report.setText((String.format("Escaped %d of them %s!", howMuchRun,player.getName())));
+ report.setText((String.format("Escaped %d of them %s!", howMuchRun, player.getName())));
}
}
@@ -250,7 +252,7 @@ public class ShipWarfareGUI {
player.setGuns(player.getGuns() - 1);
gunFrustration = true;
} else {
- if (numOfPeasantShips>0) {
+ if (numOfPeasantShips > 0) {
player.setHP(player.getHP() - (1 + randomValue.nextInt(10)));
}
@@ -275,7 +277,7 @@ public class ShipWarfareGUI {
if (exitValue == 1) {
wipe();
chooseFightOrRun.setText(String.format("Ayy! We won and survived at %d%% ship status!", player.getHP()));
- calculateLoot = (startingPeasantShips *100) + randomValue.nextInt(startingPeasantShips) *200;
+ calculateLoot = (startingPeasantShips * 100) + randomValue.nextInt(startingPeasantShips) * 200;
player.setMoney(player.getMoney() + calculateLoot);
report.setText(String.format("Our firm has earned $%,d in loot! ", calculateLoot));
continueButton.setVisible(true);
@@ -295,11 +297,12 @@ public class ShipWarfareGUI {
/**
* Sets up the graphical part of ShipWarfare and includes all logic for the class
+ *
* @param stage sets the stage to which we will execute the scene of the ShipWarfare class
* @return stage so that another class can switch to the stage
*/
- public Stage initializeShip(Stage stage){
+ public Stage initializeShip(Stage stage) {
setNumOfPeasantShips(numOfShips());
BorderPane BorderPane = new BorderPane();
@@ -325,7 +328,6 @@ public class ShipWarfareGUI {
continueButton.setVisible(false);
-
BorderPane.setPrefHeight(400.0);
BorderPane.setPrefWidth(600.0);
hBox.setAlignment(javafx.geometry.Pos.CENTER);
@@ -336,7 +338,7 @@ public class ShipWarfareGUI {
title.setAlignment(javafx.geometry.Pos.TOP_CENTER);
title.setContentDisplay(javafx.scene.control.ContentDisplay.CENTER);
title.setId("Label1");
- title.setText(String.format("%d ships attacking. Would you like to Fight or Run?",numOfPeasantShips));
+ title.setText(String.format("%d ships attacking. Would you like to Fight or Run?", numOfPeasantShips));
title.setPadding(new Insets(6.0, 0.0, 0.0, 0.0));
continueButton.setMnemonicParsing(false);
@@ -352,7 +354,8 @@ public class ShipWarfareGUI {
runButton.setId("Button2");
runButton.setMnemonicParsing(false);
- BorderPane.setBottom(hBox);runButton.setText("Run");
+ BorderPane.setBottom(hBox);
+ runButton.setText("Run");
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
vBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
@@ -392,7 +395,7 @@ public class ShipWarfareGUI {
counter++;
chooseFightOrRun.setText("Ohh, Fight ehh?");
try {
- if (destroyPeasantShipsOrEscape(stage)){
+ if (destroyPeasantShipsOrEscape(stage)) {
completeWipe();
continueButton.setVisible(true);
fightButton.setVisible(false);
@@ -438,7 +441,7 @@ public class ShipWarfareGUI {
chooseFightOrRun.setVisible(false);
report.setText(("Couldn't run away"));
try {
- if(destroyPeasantShipsOrEscape(stage)==true){
+ if (destroyPeasantShipsOrEscape(stage) == true) {
completeWipe();
continueButton.setVisible(true);
fightButton.setVisible(false);
@@ -468,7 +471,7 @@ public class ShipWarfareGUI {
}
- if (counter>=2){
+ if (counter >= 2) {
title.setVisible(false);
}
}
@@ -485,9 +488,10 @@ public class ShipWarfareGUI {
/**
* sets scene and runs stage
+ *
* @param primaryStage the stage in which the scene may be run and switched to
*/
- public void start(Stage primaryStage){
+ public void start(Stage primaryStage) {
primaryStage = initializeShip(primaryStage);
primaryStage.show();
}
From 5b8682a900edb4d3ef625a97971a8ec7dc970244 Mon Sep 17 00:00:00 2001
From: Vikramb987 <47336882+Vikramb987@users.noreply.github.com>
Date: Sun, 10 Mar 2019 23:18:20 -0600
Subject: [PATCH 2/5] Update TaipanShopGUI.java
finished javadocs
---
src/TaipanShopGUI.java | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/TaipanShopGUI.java b/src/TaipanShopGUI.java
index 94a74eb..08c83e3 100644
--- a/src/TaipanShopGUI.java
+++ b/src/TaipanShopGUI.java
@@ -1,4 +1,3 @@
-import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
@@ -310,7 +309,7 @@ public class TaipanShopGUI {
}
/**
- *
+ * this method is responsible for the actual purchasing/selling of items, and the text associated with the act.
*/
public void shop(){
String originalDialogue = textOut.getText();
@@ -378,6 +377,11 @@ public class TaipanShopGUI {
}
}
+ /**
+ * Initializes the shop on the given stage as a parameter.
+ *
+ * @param stage
+ */
public void initializeShop(Stage stage){
Font size14 = new Font(14.0);
Rectangle dialogueRectangle = new Rectangle();
@@ -472,6 +476,7 @@ public class TaipanShopGUI {
buyButton.setPrefHeight(25.0);
buyButton.setPrefWidth(45.0);
buyButton.setText("Buy");
+ // if the buy button is clicked, the main utility buttons are set to be invisible and the buying process begins.
buyButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -484,6 +489,7 @@ public class TaipanShopGUI {
sellButton.setPrefHeight(25.0);
sellButton.setText("Sell");
+ // if the sell button is clicked, the main utility buttons are set to be invisible and the selling process begins.
sellButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -497,6 +503,7 @@ public class TaipanShopGUI {
sellButton.setMnemonicParsing(false);
bankButton.setPrefHeight(25.0);
+ // opens the bank if the bank button is clicked.
bankButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -513,6 +520,7 @@ public class TaipanShopGUI {
cargoButton.setText("Transfer Cargo");
cargoButton.setMnemonicParsing(false);
cargoButton.setPrefWidth(94.0);
+ // warehouse is entered when the warehouse button is clicked.
cargoButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -526,6 +534,7 @@ public class TaipanShopGUI {
loanButton.setMnemonicParsing(false);
loanButton.setPrefHeight(25.0);
loanButton.setPrefWidth(73.0);
+ // loan office is entered when the loan button is clicked.
loanButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -540,6 +549,7 @@ public class TaipanShopGUI {
quitButton.setMnemonicParsing(false);
quitButton.setPrefWidth(90.0);
quitButton.setText("Quit Trading");
+ // the user is free to travel once the quit button is clicked.
quitButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -554,6 +564,7 @@ public class TaipanShopGUI {
retireButton.setPrefWidth(49.0);
retireButton.setText("Retire");
retireButton.setVisible(false);
+ // the user wins the game when the retire button is clicked.
retireButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -567,6 +578,7 @@ public class TaipanShopGUI {
opiumButton.setPrefHeight(25.0);
opiumButton.setText("Opium");
opiumButton.setVisible(false);
+ // the opium buying/selling process starts as soon as the user clicks the opium button.
opiumButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -588,6 +600,7 @@ public class TaipanShopGUI {
silkButton.setMnemonicParsing(false);
silkButton.setText("Silk");
silkButton.setVisible(false);
+ // the silk buying/selling process starts as soon as the user clicks the silk button.
silkButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -607,6 +620,7 @@ public class TaipanShopGUI {
armsButton.setPrefWidth(86.0);
armsButton.setMnemonicParsing(false);
armsButton.setVisible(false);
+ // the arms buying/selling process starts as soon as the user clicks the arms button.
armsButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -630,6 +644,7 @@ public class TaipanShopGUI {
generalButton.setPrefWidth(86.0);
generalButton.setText("General");
generalButton.setVisible(false);
+ // the general cargo buying/selling process starts as soon as the user clicks the general cargo button.
generalButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -649,6 +664,8 @@ public class TaipanShopGUI {
numberInput.setAlignment(javafx.geometry.Pos.CENTER_RIGHT);
numberInput.setText("Enter amount here...");
numberInput.setVisible(false);
+ // after the user inputs a valid input into the text field and presses Z or ENTER, the buying/selling ends and
+ // the user is returned to the regular shop dialogue.
numberInput.setOnKeyPressed(new EventHandler() {
@Override
public void handle(KeyEvent event) {
@@ -763,12 +780,18 @@ public class TaipanShopGUI {
stage.setResizable(false);
stage.setScene(root);
+ // general updates to the buttons, user stats/inventory, and text.
buttonSetup("reset");
updatePrices();
defaultTextOut();
updateStage();
}
-
+
+ /**
+ * converts the user's location (an integer) to a String, and returns it.
+ *
+ * @return location -- the user's location as a string; the actual name of the location.
+ */
public String getStringLocation(){
String location;
switch(player.getLocation()){
@@ -783,7 +806,12 @@ public class TaipanShopGUI {
}
return location;
}
-
+
+ /**
+ * returns the user's condition based upon their current HP.
+ *
+ * @return shipStatus -- a representation of their ship's health in words.
+ */
public String shipStatusString(){
String shipStatus;
switch(player.getHP()/10){
@@ -802,7 +830,10 @@ public class TaipanShopGUI {
}
return shipStatus;
}
-
+
+ /**
+ * updates the text associated with the user's inventory.
+ */
public void updateStage(){
firm.setText(String.format("Firm: %s, %s", player.getName(), getStringLocation()));
wItemsText.setText(String.format("\n %d\n %d\n %d\n %d", player.getwOpium(), player.getwSilk(), player.getwArms(), player.getwGeneral()));
From 0af20d9f67a6892fa42f2dba77727df1766d719f Mon Sep 17 00:00:00 2001
From: KahootChampion
Date: Sun, 10 Mar 2019 23:42:37 -0600
Subject: [PATCH 3/5] Changed one line of text in shipwarfare GUI
---
src/ShipWarfareGUI.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ShipWarfareGUI.java b/src/ShipWarfareGUI.java
index 4ed6c83..13a68ce 100644
--- a/src/ShipWarfareGUI.java
+++ b/src/ShipWarfareGUI.java
@@ -35,6 +35,7 @@ public class ShipWarfareGUI {
/**
* 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) {
@@ -272,7 +273,7 @@ public class ShipWarfareGUI {
userAttacks = true;
}
- continueToFight.setText(String.format("Shall we continue to fight? (Click the fight button or the run button)", player.getGuns()));
+ continueToFight.setText(String.format("Captain, what are your orders? (Click the fight button or the run button)", player.getGuns()));
if (exitValue == 1) {
wipe();
From 1df0cbec3647bc41b53087c0fed5bb8e6ea82321 Mon Sep 17 00:00:00 2001
From: Nathan Lum <33772546+Templarre@users.noreply.github.com>
Date: Sun, 10 Mar 2019 23:42:24 -0600
Subject: [PATCH 4/5] Added Javadoc comments
---
src/bankGUI.java | 51 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 39 insertions(+), 12 deletions(-)
diff --git a/src/bankGUI.java b/src/bankGUI.java
index 5c0ad4d..be037e6 100644
--- a/src/bankGUI.java
+++ b/src/bankGUI.java
@@ -41,31 +41,40 @@ public class bankGUI{
this.player = playerDummy;
}
+ /**
+ * Initializes the GUI for the Bank in our game.
+ *
+ * @param primaryStage
+ * @return
+ */
public Stage initializeBank(Stage primaryStage) {
primaryStage.setTitle("Bank");
- //Declaring each Layout
+ /**
+ * Creating all the layouts, labels, buttons, and a textfield.
+ *
+ */
BorderPane brdr1 = new BorderPane();
HBox hbx1 = new HBox(30);
HBox hbx2 = new HBox(30);
VBox vbx1 = new VBox(30);
- //Declaring all Variables
Label l1 = new Label("Player: " + player.getName());
Label l2 = new Label("Current Balance: " + player.getBank());
Label l3 = new Label("Enter Amount: ");
Label l4 = new Label("Current cash: " + player.getMoney());
Label l5 = new Label(" ");
- //Declaring All Buttons
Button b1 = new Button("Withdraw");
Button b2 = new Button("Deposit");
Button b3 = new Button("Go back");
- //Declaring All TextFields
TextField txtField1 = new TextField();
- //Creating the buttons at the bottom of the screen
+ /**
+ * Adds the buttons so that they are at the bottom of the screen.
+ *
+ */
hbx1.setAlignment(Pos.CENTER);
hbx1.getChildren().add(b1);
hbx1.getChildren().add(b2);
@@ -73,13 +82,19 @@ public class bankGUI{
brdr1.setBottom(hbx1);
- //Creating the TextField at the center of the screen
+ /**
+ * Adds the text field to the center of the screen.
+ *
+ */
hbx2.setAlignment(Pos.CENTER);
hbx2.getChildren().add(l3);
hbx2.getChildren().add(txtField1);
brdr1.setCenter(hbx2);
- //Creating the Labels at the top of the Screen
+ /**
+ * Adds the labels to the top of the screen.
+ *
+ */
vbx1.setAlignment(Pos.CENTER);
vbx1.getChildren().add(l1);
vbx1.getChildren().add(l2);
@@ -87,7 +102,10 @@ public class bankGUI{
vbx1.getChildren().add(l5);
brdr1.setTop(vbx1);
- // Set the event handler when the deposit button is clicked
+ /**
+ * Adds function to button 1 which, when clicked, withdraws money from your bank to your person but, will not let you overdraw.
+ *
+ */
b1.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -106,6 +124,10 @@ public class bankGUI{
}
);
+ /**
+ * Adds function to button 2 which, when clicked, deposits money into your bank but, will not let you overdraw.
+ *
+ */
// Set the event handler when the withdraw button is clicked
b2.setOnAction(new EventHandler() {
@Override
@@ -126,6 +148,10 @@ public class bankGUI{
}
);
+ /**
+ * Adds function to button 3 which, when clicked, brings you back to the Shop GUI.
+ *
+ */
b3.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -137,15 +163,16 @@ public class bankGUI{
);
-
- //Setting the Scene and displaying it
+ /**
+ * Sets the window size to a width of 600 and height of 480 and displays the screen.
+ *
+ */
Scene scene = new Scene(brdr1, 600, 480);
primaryStage.setScene(scene);
//primaryStage.show();
return primaryStage;
}
-
-
+
public void start(Stage primaryStage) {
bankGUI bank = new bankGUI(player);
bank.initializeBank(primaryStage);
From 1ac82edf1eb05d53fa2cd679c9d3b270796fda42 Mon Sep 17 00:00:00 2001
From: Nathan Lum <33772546+Templarre@users.noreply.github.com>
Date: Sun, 10 Mar 2019 23:43:19 -0600
Subject: [PATCH 5/5] Added Javadoc comments
---
src/StartGUI.java | 71 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 4 deletions(-)
diff --git a/src/StartGUI.java b/src/StartGUI.java
index 992b1ad..38b18f6 100644
--- a/src/StartGUI.java
+++ b/src/StartGUI.java
@@ -69,54 +69,112 @@ public class StartGUI {
this.player = playerTemp;
}
+ /**
+ * Initializes the Start GUI the game.
+ *
+ * @param stage object of type Stage
+ * @return returns the stage of GUI
+ */
public Stage initializeStart(Stage stage){
+ /**
+ * Creates an HBox at the center of the borderpane with a width of 200, height of 100 and spacing of 10.
+ *
+ */
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
hBox.setAlignment(javafx.geometry.Pos.CENTER);
hBox.setPrefHeight(100.0);
hBox.setPrefWidth(200.0);
hBox.setSpacing(10.0);
+ /**
+ * Creates a borderpane window of width 600 and height 480.
+ *
+ */
borderPane.setPrefHeight(480.0);
borderPane.setPrefWidth(600.0);
- nameField.setPromptText("Enter your name.");
+ /**
+ * Creates a prompt text field that asks for your firm name and has a default text set to "Taipan".
+ *
+ */
+ nameField.setPromptText("Enter Firm Name.");
nameField.setText("Taipan");
+ /**
+ * Creates a button with text "Start"
+ *
+ */
startButton.setMnemonicParsing(false);
startButton.setText("Start");
+ /**
+ * Creates a VBox at the left of center of the borderpane.
+ *
+ */
vBox.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
+ /**
+ * Creates a label with text "Do you want to start with..." to indicate the user has to choose between 2 given scenarios.
+ *
+ */
choiceLabel.setText("Do you want to start with...");
+ /**
+ * Label for scenario one which is you start with five guns and no cash or debt.
+ *
+ */
gunChoice.setMnemonicParsing(false);
gunChoice.setSelected(true);
gunChoice.setText("Five guns and no cash (But no debt!)?");
gunChoice.setToggleGroup(Start);
+ /**
+ * Label for scenario 2 which is you start with cash but also a debt.
+ *
+ */
cashChoice.setAlignment(javafx.geometry.Pos.TOP_LEFT);
cashChoice.setMnemonicParsing(false);
cashChoice.setText("Cash (and a debt)");
cashChoice.setToggleGroup(Start);
borderPane.setBottom(hBox);
+ /**
+ * Creates a VBox at the center of the borderpane with a width of 100 and height of 200.
+ *
+ */
BorderPane.setAlignment(vBox0, javafx.geometry.Pos.CENTER);
vBox0.setAlignment(javafx.geometry.Pos.CENTER);
vBox0.setPrefHeight(200.0);
vBox0.setPrefWidth(100.0);
+ /**
+ * Creates a label with text "Taipan" in size 66 font and default font style.
+ *
+ */
title.setText("Taipan");
title.setFont(new Font(66.0));
+ /**
+ * Creates a label with our names as text
+ *
+ */
authors.setPrefHeight(80.0);
authors.setPrefWidth(499.0);
authors.setText("By Vikram Bawa, Haris Muhammad, Siddhant Dewani, Nathan Lum and Harkamal Randhawa");
+ /**
+ * Puts Vbox0 in the center of the borderpane.
+ *
+ */
authors.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
borderPane.setCenter(vBox0);
+ /**
+ * Adds all the buttons and labels to their respective boxes.
+ *
+ */
hBox.getChildren().add(nameField);
hBox.getChildren().add(startButton);
vBox.getChildren().add(choiceLabel);
@@ -126,6 +184,11 @@ public class StartGUI {
vBox0.getChildren().add(title);
vBox0.getChildren().add(authors);
+ /**
+ * Adds function to the "Start" button, scenario 1 gives the player $400 and a $5000 debt at the start of the game;
+ * scenario 2 gives the player 5 guns.
+ *
+ */
startButton.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent event) {
@@ -143,9 +206,9 @@ public class StartGUI {
if (response.equalsIgnoreCase("Vikram")) {
player.setMoney(999999999);
player.setBank(999999999);
- player.setGuns(999);
- player.setHP(999999999);
- player.setCargoSpace(999999999);
+ player.setGuns(0);
+ player.setHP(99999999);
+ player.setCargoSpace(Integer.MAX_VALUE);
}
setFirm(response);