Commit 0c021340 authored by patrick.gustard-sm's avatar patrick.gustard-sm

Game Runs now

parent 689edd90
......@@ -87,7 +87,7 @@ if (isShip == true) {
//if cell contains a ship
setFill(Color.ORANGE);
Main.HealthEnemy --;
if (Main.HealthEnemy < 1) {
System.out.println("You Win!"); // Once the player reduces the enemy ships or health (same thing) to zero then they win
......@@ -114,7 +114,7 @@ enemyTurn();
}
public void place(int ships, boolean vertical, int xIn, int yIn) { // The array in main will make sure the ships placed will be in order of what I put them in the array and in length
public void place(boolean vertical, int ships, int xIn, int yIn) { // The array in main will make sure the ships placed will be in order of what I put them in the array and in length
System.out.println(ships);
......
......@@ -17,7 +17,7 @@ import javafx.scene.input.MouseButton;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
......@@ -84,17 +84,17 @@ public class Main extends Application {
System.out.println("placing");
BoardPlayer.place(ships[shipnum], vertical, xInteger, yInteger);
BoardPlayer.place(vertical,ships[shipnum], xInteger, yInteger);
shipnum ++;
// to-do: set setup to false when shipnum is too big? (i.e. when it's 8)
// to-do: set setup to false when shipnum reaches the end of its array (i.e. when it's 7)
}
if (shipnum == 8) {
if (shipnum == 7) {
startGame();
......@@ -178,20 +178,20 @@ public class Main extends Application {
//prevents placement in obstructed areas
System.out.println("calling place at " + ComputerX + " " + ComputerY);
BoardEnemy.place(ships[enemyshipnum], aiVert, ComputerX, ComputerY);
BoardEnemy.place(aiVert,ships[enemyshipnum], ComputerX, ComputerY);
//Places the ships from the board
System.out.println(enemyshipnum);
//so the for Loop will count up by one
enemyshipnum++;
System.out.println(enemyshipnum);
}
//Repeat enemy place till it reaches 8, use a loop to repeat the statement enemyPlace
//Repeat enemy place till it reaches 7, use a loop to repeat the statement enemyPlace
}
if (enemyshipnum == 8) {//Stops the loop when the variable is reached starting the game
if (enemyshipnum == 7) {//Stops the loop when the variable is reached starting the game
startGame();
}
......@@ -199,9 +199,7 @@ public class Main extends Application {
public static void startGame(){
enemyshipnum=0;
while(enemyshipnum<=8)
while(enemyshipnum<=7)
{
enemyPlace();
}
......
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