Commit 2b5e50d5 authored by Darth Vernon's avatar Darth Vernon

GUI ALTERNATIVE

parent 96b49fcb
......@@ -281,8 +281,11 @@
<Label fx:id="c0A" layoutX="460.0" layoutY="342.0" prefHeight="67.0" prefWidth="53.0" text="Label" />
</children>
</GridPane>
<Label fx:id="occupiedSpace" layoutX="165.0" layoutY="690.0" prefHeight="17.0" prefWidth="734.0" text="Your ships are :" />
<Label fx:id="EnemyHM" layoutX="532.0" layoutY="600.0" prefHeight="17.0" prefWidth="368.0" text="Computer: Prepare to die!" />
<Label fx:id="occupiedSpace" layoutX="165.0" layoutY="690.0" prefHeight="17.0" prefWidth="734.0" text="Your occupied coordinates are :" />
<Label fx:id="enemyHM" layoutX="532.0" layoutY="600.0" prefHeight="17.0" prefWidth="368.0" text="Computer: Prepare to die!" />
<Label fx:id="takenShips" layoutY="707.0" prefHeight="17.0" prefWidth="501.0" text="Taken Ships:" />
<Label fx:id="lostShips" layoutX="509.0" layoutY="707.0" prefHeight="17.0" prefWidth="540.0" text="Lost Ships:" />
<Label fx:id="hits" layoutX="165.0" layoutY="572.0" prefHeight="17.0" prefWidth="344.0" text="Hits:" />
</children>
</AnchorPane>
</children>
......
......@@ -30,8 +30,14 @@ public class BSMain extends Application{
@FXML public ChoiceBox<String> DPy;
@FXML public ChoiceBox<String> shipSelection;
@FXML public Label occupiedSpace;
@FXML public Label EnemyHM;
@FXML public Label enemyHM;
@FXML public Label lostShips;
@FXML public Label takenShips;
@FXML public Label hits;
ArrayList<String> hitsList = new ArrayList<String>();
ArrayList<String> lostShipsList = new ArrayList<String>();
ArrayList<String> takenShipsList = new ArrayList<String>();
@FXML private Button place;
@FXML private Button fire;
......@@ -42,235 +48,7 @@ public class BSMain extends Application{
@FXML public Label admiral;
@FXML public Label status;
@FXML public Label p0A;
@FXML public Label p1A;
@FXML public Label p2A;
@FXML public Label p3A;
@FXML public Label p4A;
@FXML public Label p5A;
@FXML public Label p6A;
@FXML public Label p7A;
@FXML public Label p8A;
@FXML public Label p9A;
@FXML public Label c0A;
@FXML public Label c1A;
@FXML public Label c2A;
@FXML public Label c3A;
@FXML public Label c4A;
@FXML public Label c5A;
@FXML public Label c6A;
@FXML public Label c7A;
@FXML public Label c8A;
@FXML public Label c9A;
@FXML public Label p0B;
@FXML public Label p1B;
@FXML public Label p2B;
@FXML public Label p3B;
@FXML public Label p4B;
@FXML public Label p5B;
@FXML public Label p6B;
@FXML public Label p7B;
@FXML public Label p8B;
@FXML public Label p9B;
@FXML public Label c0B;
@FXML public Label c1B;
@FXML public Label c2B;
@FXML public Label c3B;
@FXML public Label c4B;
@FXML public Label c5B;
@FXML public Label c6B;
@FXML public Label c7B;
@FXML public Label c8B;
@FXML public Label c9B;
@FXML public Label p0C;
@FXML public Label p1C;
@FXML public Label p2C;
@FXML public Label p3C;
@FXML public Label p4C;
@FXML public Label p5C;
@FXML public Label p6C;
@FXML public Label p7C;
@FXML public Label p8C;
@FXML public Label p9C;
@FXML public Label c0C;
@FXML public Label c1C;
@FXML public Label c2C;
@FXML public Label c3C;
@FXML public Label c4C;
@FXML public Label c5C;
@FXML public Label c6C;
@FXML public Label c7C;
@FXML public Label c8C;
@FXML public Label c9C;
@FXML public Label p0D;
@FXML public Label p1D;
@FXML public Label p2D;
@FXML public Label p3D;
@FXML public Label p4D;
@FXML public Label p5D;
@FXML public Label p6D;
@FXML public Label p7D;
@FXML public Label p8D;
@FXML public Label p9D;
@FXML public Label c0D;
@FXML public Label c1D;
@FXML public Label c2D;
@FXML public Label c3D;
@FXML public Label c4D;
@FXML public Label c5D;
@FXML public Label c6D;
@FXML public Label c7D;
@FXML public Label c8D;
@FXML public Label c9D;
@FXML public Label p0F;
@FXML public Label p1F;
@FXML public Label p2F;
@FXML public Label p3F;
@FXML public Label p4F;
@FXML public Label p5F;
@FXML public Label p6F;
@FXML public Label p7F;
@FXML public Label p8F;
@FXML public Label p9F;
@FXML public Label c0F;
@FXML public Label c1F;
@FXML public Label c2F;
@FXML public Label c3F;
@FXML public Label c4F;
@FXML public Label c5F;
@FXML public Label c6F;
@FXML public Label c7F;
@FXML public Label c8F;
@FXML public Label c9F;
@FXML public Label p0E;
@FXML public Label p1E;
@FXML public Label p2E;
@FXML public Label p3E;
@FXML public Label p4E;
@FXML public Label p5E;
@FXML public Label p6E;
@FXML public Label p7E;
@FXML public Label p8E;
@FXML public Label p9E;
@FXML public Label c0E;
@FXML public Label c1E;
@FXML public Label c2E;
@FXML public Label c3E;
@FXML public Label c4E;
@FXML public Label c5E;
@FXML public Label c6E;
@FXML public Label c7E;
@FXML public Label c8E;
@FXML public Label c9E;
@FXML public Label p0G;
@FXML public Label p1G;
@FXML public Label p2G;
@FXML public Label p3G;
@FXML public Label p4G;
@FXML public Label p5G;
@FXML public Label p6G;
@FXML public Label p7G;
@FXML public Label p8G;
@FXML public Label p9G;
@FXML public Label c0G;
@FXML public Label c1G;
@FXML public Label c2G;
@FXML public Label c3G;
@FXML public Label c4G;
@FXML public Label c5G;
@FXML public Label c6G;
@FXML public Label c7G;
@FXML public Label c8G;
@FXML public Label c9G;
@FXML public Label p0H;
@FXML public Label p1H;
@FXML public Label p2H;
@FXML public Label p3H;
@FXML public Label p4H;
@FXML public Label p5H;
@FXML public Label p6H;
@FXML public Label p7H;
@FXML public Label p8H;
@FXML public Label p9H;
@FXML public Label c0H;
@FXML public Label c1H;
@FXML public Label c2H;
@FXML public Label c3H;
@FXML public Label c4H;
@FXML public Label c5H;
@FXML public Label c6H;
@FXML public Label c7H;
@FXML public Label c8H;
@FXML public Label c9H;
@FXML public Label p0I;
@FXML public Label p1I;
@FXML public Label p2I;
@FXML public Label p3I;
@FXML public Label p4I;
@FXML public Label p5I;
@FXML public Label p6I;
@FXML public Label p7I;
@FXML public Label p8I;
@FXML public Label p9I;
@FXML public Label c0I;
@FXML public Label c1I;
@FXML public Label c2I;
@FXML public Label c3I;
@FXML public Label c4I;
@FXML public Label c5I;
@FXML public Label c6I;
@FXML public Label c7I;
@FXML public Label c8I;
@FXML public Label c9I;
@FXML public Label p0J;
@FXML public Label p1J;
@FXML public Label p2J;
@FXML public Label p3J;
@FXML public Label p4J;
@FXML public Label p5J;
@FXML public Label p6J;
@FXML public Label p7J;
@FXML public Label p8J;
@FXML public Label p9J;
@FXML public Label c0J;
@FXML public Label c1J;
@FXML public Label c2J;
@FXML public Label c3J;
@FXML public Label c4J;
@FXML public Label c5J;
@FXML public Label c6J;
@FXML public Label c7J;
@FXML public Label c8J;
@FXML public Label c9J;
@FXML Label computerLabels[] = {c0A,c0B,c0C,c0D,c0E,c0F,c0G,c0H,c0I,c0J,c1A,c1B,c1C,c1D,c1E,c1F,c1G,c1H,c1I,c1J,c2A,c2B,c2C,c2D,c2E,c2F,c2G,c2H,c2I,c2J,
c3A,c3B,c3C,c3D,c3E,c3F,c3G,c3H,c3I,c3J,c4A,c4B,c4C,c4D,c4E,c4F,c4G,c4H,c4I,c4J
,c5A,c5B,c5C,c5D,c5E,c5F,c5G,c5H,c5I,c5J,c6A,c6B,c6C,c6D,c6E,c6F,c6G,c6H,c6I,c6J,c7A,c7B,c7C,c7D,c7E,c7F,c7G,c7H,c7I,c7J,c8A,c8B,c8C,c8D,c8E,c8F,c8G,c8H,c8I,c8J,
c9A,c9B,c9C,c9D,c9E,c9F,c9G,c9H,c9I,c9J};
@FXML Label playerLabels[] = {p0A,p0B,p0C,p0D,p0E,p0F,p0G,p0H,p0I,p0J,p1A,p1B,p1C,p1D,p1E,p1F,p1G,p1H,p1I,p1J,p2A,p2B,p2C,p2D,p2E,p2F,p2G,p2H,p2I,p2J,
p3A,p3B,p3C,p3D,p3E,p3F,p3G,p3H,p3I,p3J,p4A,p4B,p4C,p4D,p4E,p4F,p4G,p4H,p4I,p4J
,p5A,p5B,p5C,p5D,p5E,p5F,p5G,p5H,p5I,p5J,p6A,p6B,p6C,p6D,p6E,p6F,p6G,p6H,p6I,p6J,p7A,p7B,p7C,p7D,p7E,p7F,p7G,p7H,p7I,p7J,p8A,p8B,p8C,p8D,p8E,p8F,p8G,p8H,p8I,p8J,
p9A,p9B,p9C,p9D,p9E,p9F,p9G,p9H,p9I,p9J};
ObservableList<String> numbrz = FXCollections.observableArrayList("0","1","2","3","4","5","6","7","8","9");
......@@ -347,8 +125,8 @@ public class BSMain extends Application{
if (!playerS.ShipPlacer(playerS,ship, x, y).isEmpty()) {
response = playerS.moves.toString();
admiral.setText("Admiral Nutsey: Ship placed at " + response);
playerLabels[1].setText("Ship placed");
admiral.setText("Admiral Nutsey: Your occupied coordinates are: " + response);
}
else {
admiral.setText("Admiral: Ship type is already Placed");
......@@ -377,7 +155,7 @@ public class BSMain extends Application{
Boolean win = true;
stage1 = false;
admiral.setText("Admiral Nutsey: You have lost :( ");
EnemyHM.setText(ComputerInput.talk(win));
enemyHM.setText(ComputerInput.talk(win));
stage.setText("Stage: GAME OVER");
}
......@@ -385,7 +163,7 @@ public class BSMain extends Application{
Boolean win = false;
stage1 = false;
admiral.setText("Admiral Nutsey: You have won!!!");
EnemyHM.setText(ComputerInput.talk(win));
enemyHM.setText(ComputerInput.talk(win));
}
else if (stage1) {
......@@ -395,8 +173,14 @@ public class BSMain extends Application{
+ (String) ComputerInput.CoOrdRandomiser().get(1);
if (playerB.fire(computerS, HmnMove)) {
admiral.setText("Player has " + BattleClass.ShipCheck(HmnMove, computerS));
String response = BattleClass.ShipCheck(HmnMove, computerS);
admiral.setText("Player has " + response + HmnMove );
hitsList.add(HmnMove);
hits.setText("You have hit:" + hitsList.toString());
if (response != "Hit ") {
takenShipsList.add(response);
lostShips.setText("You have lost:" + takenShipsList.toString());
}
}
else if (!playerB.fire(computerS, HmnMove)) {
admiral.setText("Player has missed at " + HmnMove);
......@@ -406,10 +190,15 @@ public class BSMain extends Application{
if (computerB.fire(playerS, CmptrMove)) {
EnemyHM.setText("Computer: I have hit " + BattleClass.ShipCheck(CmptrMove, playerS));
String response = BattleClass.ShipCheck(CmptrMove, playerS);
enemyHM.setText("Computer: I have hit " + response + CmptrMove );
if (response != "Hit ") {
lostShipsList.add(response);
lostShips.setText("You have lost:" + lostShipsList.toString());
}
}
else if (!computerB.fire(playerS, CmptrMove)) {
EnemyHM.setText("Computer: I have missed at " + CmptrMove);
enemyHM.setText("Computer: I have missed at " + CmptrMove);
}
......
......@@ -25,7 +25,7 @@ public class BattleClass {
public static String ShipCheck(String coordinates, ShipClass opponent) {
String response = "Hit on " + coordinates;
String response = "Hit ";
if (opponent.aC.contains(coordinates)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment