Finished cleaning up the code. Ready for Demo 2
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
@@ -22,19 +21,15 @@ public class GameEndGUI {
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the graphical part of GameEndGUI and includes all logic for the class
|
||||
*
|
||||
* @param stage sets the stage to which we will execute the scene of the GameEndGUI class
|
||||
* @return stage so that another class can switch to the stage
|
||||
*/
|
||||
public Stage initializeGameEndGUI(Stage stage) {
|
||||
|
||||
//Creating all the nodes
|
||||
title = new Label();
|
||||
vBox = new VBox();
|
||||
firmName = new Label();
|
||||
@@ -46,6 +41,7 @@ public class GameEndGUI {
|
||||
borderPane.setPrefHeight(480.0);
|
||||
borderPane.setPrefWidth(600.0);
|
||||
|
||||
//Setting positions and names of all the nodes
|
||||
BorderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
title.setText("Game Over!");
|
||||
title.setFont(new Font(43.0));
|
||||
@@ -69,21 +65,29 @@ public class GameEndGUI {
|
||||
borderPane.setCenter(vBox);
|
||||
|
||||
|
||||
//Adding the labels to the character's stats to the VBox which will show up on the screen
|
||||
vBox.getChildren().add(firmName);
|
||||
vBox.getChildren().add(gunsHeld);
|
||||
vBox.getChildren().add(netWorth);
|
||||
|
||||
/**
|
||||
* If health is below or equal to 0 then the game will either show the gameOver screen or the win screen
|
||||
* */
|
||||
if (player.getHP() <= 0) {
|
||||
title.setText("Game Over!");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
title.setText("Congratulations!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the networth of the player by the end of the game
|
||||
* */
|
||||
netWorthInt = player.getMoney() + (player.getOpiumHeld() * 16000) + (player.getSilkHeld() * 160) + (player.getArmsHeld() * 160) + (player.getGeneralHeld() * 8);
|
||||
netWorthInt += (player.getwOpium() * 16000) + (player.getwSilk() * 160) + (player.getwArms() * 160) + (player.getwGeneral() * 8);
|
||||
netWorthInt -= player.getDebt();
|
||||
|
||||
|
||||
//Updating the endgame stats of the player
|
||||
firmName.setText("Firm Name: " + player.getName());
|
||||
gunsHeld.setText("Guns Held: " + player.getGuns());
|
||||
netWorth.setText("Net Worth: " + netWorthInt);
|
||||
@@ -97,7 +101,11 @@ public class GameEndGUI {
|
||||
return stage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sets scene and runs stage
|
||||
*
|
||||
* @param primaryStage the stage in which the scene may be run and switched to
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
GameEndGUI gameEndGUI = new GameEndGUI(player);
|
||||
gameEndGUI.initializeGameEndGUI(primaryStage);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@@ -31,6 +30,7 @@ public class MainGUI extends Application {
|
||||
/**
|
||||
* Updates main class with player data and starts the game.
|
||||
* The game will only run as long as the player has not retired or has been destroyed.
|
||||
*
|
||||
* @param args Just the console for the player to look at.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -437,7 +437,6 @@ public class Player {
|
||||
/**
|
||||
* Method to indicate that you have lost the game. If the player has lost, console will be cleared and will only
|
||||
* show the statement "Game Over". After showing the message the game closes.
|
||||
*
|
||||
**/
|
||||
|
||||
public void gameOver() {
|
||||
|
||||
@@ -357,7 +357,7 @@ public class ShipWarfareGUI {
|
||||
BorderPane.setBottom(hBox);
|
||||
runButton.setText("Run");
|
||||
|
||||
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
|
||||
javafx.scene.layout.BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER);
|
||||
vBox.setAlignment(javafx.geometry.Pos.TOP_CENTER);
|
||||
vBox.setPrefHeight(200.0);
|
||||
vBox.setPrefWidth(100.0);
|
||||
|
||||
@@ -52,8 +52,7 @@ public class StartGUI {
|
||||
public void setFirm(String name) {
|
||||
if (name.length() <= 22) {
|
||||
player.setName(name);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
player.setName("Taipan");
|
||||
}
|
||||
}
|
||||
@@ -63,8 +62,7 @@ public class StartGUI {
|
||||
* Copy constructor.
|
||||
* @param player object of the class Player
|
||||
*/
|
||||
public StartGUI(Player player)
|
||||
{
|
||||
public StartGUI(Player player) {
|
||||
Player playerTemp = new Player(player);
|
||||
this.player = playerTemp;
|
||||
}
|
||||
@@ -81,7 +79,7 @@ public class StartGUI {
|
||||
* 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);
|
||||
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TaipanShopGUI {
|
||||
@@ -796,14 +797,30 @@ public class TaipanShopGUI {
|
||||
public String getStringLocation() {
|
||||
String location;
|
||||
switch (player.getLocation()) {
|
||||
case 1: location = "Hong Kong"; break;
|
||||
case 2: location = "Shanghai"; break;
|
||||
case 3: location = "Nagasaki"; break;
|
||||
case 4: location = "Saigon"; break;
|
||||
case 5: location = "Manila"; break;
|
||||
case 6: location = "Singapore"; break;
|
||||
case 7: location = "Batavia"; break;
|
||||
default: location = "Error"; break;
|
||||
case 1:
|
||||
location = "Hong Kong";
|
||||
break;
|
||||
case 2:
|
||||
location = "Shanghai";
|
||||
break;
|
||||
case 3:
|
||||
location = "Nagasaki";
|
||||
break;
|
||||
case 4:
|
||||
location = "Saigon";
|
||||
break;
|
||||
case 5:
|
||||
location = "Manila";
|
||||
break;
|
||||
case 6:
|
||||
location = "Singapore";
|
||||
break;
|
||||
case 7:
|
||||
location = "Batavia";
|
||||
break;
|
||||
default:
|
||||
location = "Error";
|
||||
break;
|
||||
}
|
||||
return location;
|
||||
}
|
||||
@@ -816,18 +833,42 @@ public class TaipanShopGUI {
|
||||
public String shipStatusString() {
|
||||
String shipStatus;
|
||||
switch (player.getHP() / 10) {
|
||||
case 10: shipStatus = "Mint Condition"; break;
|
||||
case 9: shipStatus = "Near Perfect"; break;
|
||||
case 8: shipStatus = "Great"; break;
|
||||
case 7: shipStatus = "Good"; break;
|
||||
case 6: shipStatus = "Acceptable"; break;
|
||||
case 5: shipStatus = "Tolerable"; break;
|
||||
case 4: shipStatus = "Needs Repair"; break;
|
||||
case 3: shipStatus = "Damaged"; break;
|
||||
case 2: shipStatus = "Indangered"; break;
|
||||
case 1: shipStatus = "Near Sinking"; break;
|
||||
case 0: shipStatus = "Sinking"; break;
|
||||
default: shipStatus = "Invincible"; break;
|
||||
case 10:
|
||||
shipStatus = "Mint Condition";
|
||||
break;
|
||||
case 9:
|
||||
shipStatus = "Near Perfect";
|
||||
break;
|
||||
case 8:
|
||||
shipStatus = "Great";
|
||||
break;
|
||||
case 7:
|
||||
shipStatus = "Good";
|
||||
break;
|
||||
case 6:
|
||||
shipStatus = "Acceptable";
|
||||
break;
|
||||
case 5:
|
||||
shipStatus = "Tolerable";
|
||||
break;
|
||||
case 4:
|
||||
shipStatus = "Needs Repair";
|
||||
break;
|
||||
case 3:
|
||||
shipStatus = "Damaged";
|
||||
break;
|
||||
case 2:
|
||||
shipStatus = "Indangered";
|
||||
break;
|
||||
case 1:
|
||||
shipStatus = "Near Sinking";
|
||||
break;
|
||||
case 0:
|
||||
shipStatus = "Sinking";
|
||||
break;
|
||||
default:
|
||||
shipStatus = "Invincible";
|
||||
break;
|
||||
}
|
||||
return shipStatus;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -41,22 +36,24 @@ public class TravelGUI{
|
||||
private Boolean stormScene = false;
|
||||
|
||||
|
||||
/**
|
||||
* 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 TravelGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the graphical part of TravelGUI and includes all logic for the class
|
||||
*
|
||||
* @param stage sets the stage to which we will execute the scene of the TravelGUI class
|
||||
* @return stage so that another class can switch to the stage
|
||||
*/
|
||||
public Stage initializeTravel(Stage stage){
|
||||
//Updates the stage for the first-time you read it
|
||||
updateStage();
|
||||
|
||||
Font size14 = new Font(14.0);
|
||||
@@ -148,6 +145,7 @@ public class TravelGUI{
|
||||
flowPane.setPrefHeight(200.0);
|
||||
flowPane.setPrefWidth(200.0);
|
||||
|
||||
//Creating the continue and quit buttons
|
||||
quitButton.setPrefHeight(25.0);
|
||||
quitButton.setMnemonicParsing(false);
|
||||
quitButton.setPrefWidth(90.0);
|
||||
@@ -180,7 +178,7 @@ public class TravelGUI{
|
||||
}
|
||||
});
|
||||
|
||||
//Text input for where the player needs to go.
|
||||
//Text input for where the player needs to go inside of the game world
|
||||
numberInput.setAlignment(javafx.geometry.Pos.CENTER_RIGHT);
|
||||
numberInput.setText("Enter preferred location.");
|
||||
numberInput.setOnKeyPressed(event -> {
|
||||
@@ -217,9 +215,6 @@ public class TravelGUI{
|
||||
quitButton.setVisible(false);
|
||||
numberInput.setVisible(false);
|
||||
shopScene = true;
|
||||
//TaipanShopGUI taipanShopGUI = new TaipanShopGUI(player);
|
||||
//taipanShopGUI.initializeShop(stage);
|
||||
//stage.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,6 +290,7 @@ public class TravelGUI{
|
||||
textOut.setText(" Taipan, do you wish to go to:\n\n 1) Hong Kong, 2) Shanghai, 3) Nagasaki, 4) Saigon,\n 5) Manila, 6) Singapore, or 7) Batavia?\n After typing the number you want to go to press 'Enter' or 'Z'");
|
||||
textOut.setFont(size14);
|
||||
|
||||
//Added all the nodes into a single scene
|
||||
anchorPane.getChildren().addAll(dialogueRectangle, inventoryRectangle, warehouseRectangle);
|
||||
|
||||
hBox.getChildren().addAll(warehouseText, wItemsText, wItemSpaceText, locationText);
|
||||
@@ -410,6 +406,11 @@ public class TravelGUI{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()){
|
||||
@@ -425,6 +426,11 @@ public class TravelGUI{
|
||||
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){
|
||||
@@ -444,6 +450,9 @@ public class TravelGUI{
|
||||
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()));
|
||||
@@ -462,10 +471,4 @@ public class TravelGUI{
|
||||
cashText.setText(String.format(" Cash: $%,d", player.getMoney()));
|
||||
bankText.setText(String.format("Bank: %d", player.getBank()));
|
||||
}
|
||||
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage = initializeTravel(primaryStage);
|
||||
updateStage();
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Scene;
|
||||
@@ -13,7 +11,6 @@ import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* A class that makes the GUI for the Warehouse class.
|
||||
*
|
||||
*/
|
||||
public class WarehouseGUI {
|
||||
|
||||
@@ -48,6 +45,7 @@ public class WarehouseGUI {
|
||||
private CheckMenuItem arms;
|
||||
private CheckMenuItem silk;
|
||||
private CheckMenuItem opium;
|
||||
|
||||
/**
|
||||
* A constructor that takes an object of type Player as an argument
|
||||
*
|
||||
@@ -129,7 +127,7 @@ public class WarehouseGUI {
|
||||
* Creates a label "Hong Kong Warehouse: at the top of the borderpane.
|
||||
*
|
||||
*/
|
||||
borderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
BorderPane.setAlignment(title, javafx.geometry.Pos.CENTER);
|
||||
|
||||
title.setStrokeType(javafx.scene.shape.StrokeType.OUTSIDE);
|
||||
title.setStrokeWidth(0.0);
|
||||
@@ -154,7 +152,7 @@ public class WarehouseGUI {
|
||||
* creates an HBox at the center of the borderpane with a width of 200 and height of 100.
|
||||
*
|
||||
*/
|
||||
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
@@ -406,7 +404,7 @@ public class WarehouseGUI {
|
||||
borderPane.setRight(vBox1);
|
||||
borderPane.setTop(title);
|
||||
|
||||
borderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
BorderPane.setAlignment(hBox, javafx.geometry.Pos.CENTER);
|
||||
hBox.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
hBox.setPrefHeight(100.0);
|
||||
hBox.setPrefWidth(200.0);
|
||||
@@ -435,7 +433,7 @@ public class WarehouseGUI {
|
||||
opium.setText("Opium");
|
||||
borderPane.setBottom(hBox);
|
||||
|
||||
borderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER_LEFT);
|
||||
BorderPane.setAlignment(vBox, javafx.geometry.Pos.CENTER_LEFT);
|
||||
vBox.setPrefHeight(156.0);
|
||||
vBox.setPrefWidth(106.0);
|
||||
|
||||
@@ -476,7 +474,7 @@ public class WarehouseGUI {
|
||||
generalPlayer.setFont(new Font(18.0));
|
||||
borderPane.setLeft(vBox);
|
||||
|
||||
borderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT);
|
||||
BorderPane.setAlignment(vBox0, javafx.geometry.Pos.TOP_LEFT);
|
||||
vBox0.setAlignment(javafx.geometry.Pos.CENTER);
|
||||
vBox0.setPrefHeight(343.0);
|
||||
vBox0.setPrefWidth(261.0);
|
||||
@@ -551,7 +549,7 @@ public class WarehouseGUI {
|
||||
* Creates a VBox at the center of the borderpane with a width of 152 and a height of 48.
|
||||
*
|
||||
*/
|
||||
borderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER);
|
||||
BorderPane.setAlignment(vBox1, javafx.geometry.Pos.CENTER);
|
||||
vBox1.setPrefHeight(48.0);
|
||||
vBox1.setPrefWidth(152.0);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Pos;
|
||||
@@ -13,6 +12,7 @@ import javafx.stage.Stage;
|
||||
|
||||
public class bankGUI {
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
* setter method that takes in a Player object as an argument.
|
||||
*
|
||||
@@ -22,6 +22,7 @@ public class bankGUI{
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for obtaining a player object.
|
||||
*
|
||||
@@ -31,10 +32,11 @@ public class bankGUI{
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Constructor that takes in a type player as a parameter
|
||||
*
|
||||
//* @param player object of the class Player
|
||||
* <p>
|
||||
* //* @param player object of the class Player
|
||||
*/
|
||||
public bankGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
@@ -113,8 +115,7 @@ public class bankGUI{
|
||||
if (withdraw <= player.getBank()) {
|
||||
player.setMoney(withdraw + player.getMoney());
|
||||
player.setBank(player.getBank() - withdraw);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
l5.setText("Sorry you cannot withdraw that much");
|
||||
}
|
||||
l2.setText("Current Balance: " + player.getBank());
|
||||
@@ -135,8 +136,7 @@ public class bankGUI{
|
||||
if (deposit <= player.getMoney()) {
|
||||
player.setBank(deposit + player.getBank());
|
||||
player.setMoney(player.getMoney() - deposit);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
l5.setText("Sorry you cannot deposit that much");
|
||||
}
|
||||
l2.setText("Current Balance: " + player.getBank());
|
||||
@@ -167,10 +167,14 @@ public class bankGUI{
|
||||
*/
|
||||
Scene scene = new Scene(brdr1, 600, 480);
|
||||
primaryStage.setScene(scene);
|
||||
//primaryStage.show();
|
||||
return primaryStage;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets scene and runs stage
|
||||
*
|
||||
* @param primaryStage the stage in which the scene may be run and switched to
|
||||
*/
|
||||
public void start(Stage primaryStage) {
|
||||
bankGUI bank = new bankGUI(player);
|
||||
bank.initializeBank(primaryStage);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Pos;
|
||||
@@ -13,6 +12,7 @@ import javafx.stage.Stage;
|
||||
|
||||
public class loanSharkGUI {
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
* setter method that takes in a Player object as an argument.
|
||||
*
|
||||
@@ -22,6 +22,7 @@ public class loanSharkGUI{
|
||||
Player playerDummy = new Player(player);
|
||||
this.player = playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method for obtaining a player object.
|
||||
*
|
||||
@@ -31,10 +32,11 @@ public class loanSharkGUI{
|
||||
Player playerDummy = new Player(player);
|
||||
return playerDummy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Constructor that takes in a type player as a parameter
|
||||
*
|
||||
//* @param player object of the class Player
|
||||
* <p>
|
||||
* //* @param player object of the class Player
|
||||
*/
|
||||
public loanSharkGUI(Player player) {
|
||||
Player playerDummy = new Player(player);
|
||||
@@ -97,8 +99,7 @@ public class loanSharkGUI{
|
||||
player.setDebt(player.getDebt() + loanAsk);
|
||||
player.setMoney(player.getMoney() + loanAsk);
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
l5.setText("Sorry you cannot be loaned that much");
|
||||
}
|
||||
|
||||
@@ -117,12 +118,9 @@ public class loanSharkGUI{
|
||||
player.setDebt(player.getDebt() - returnAsk);
|
||||
player.setMoney(player.getMoney() - returnAsk);
|
||||
l4.setText("Current cash: " + player.getMoney());
|
||||
}
|
||||
|
||||
else if(returnAsk > player.getDebt()){
|
||||
} else if (returnAsk > player.getDebt()) {
|
||||
l5.setText("Sorry you cannot be loaned that much");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
l5.setText("Sorry you cannot return a negative amount");
|
||||
}
|
||||
l2.setText("Debt: " + player.getDebt());
|
||||
@@ -141,7 +139,6 @@ public class loanSharkGUI{
|
||||
);
|
||||
|
||||
|
||||
|
||||
//Setting the Scene and displaying it
|
||||
Scene scene = new Scene(brdr1, 600, 480);
|
||||
primaryStage.setScene(scene);
|
||||
|
||||
Reference in New Issue
Block a user