Commit a4943fa3 authored by patrick.gustard-sm's avatar patrick.gustard-sm

Started working on cell shot recognition

parent bc035332
......@@ -38,7 +38,8 @@ Cell cell = new Cell(x,y);
cell.setOnMouseClicked(handler);
row.getChildren().add(cell);
cell.isShot = false;
cell.isShotEnemy = false;
}
......@@ -59,6 +60,10 @@ public int xAxis;
public int yAxis;
public boolean isShotEnemy = false;
public boolean isShot = false;
public boolean isShip = false;
public boolean shoot = false;
......@@ -87,11 +92,13 @@ if (isShip == true) {
//if cell contains a ship
setFill(Color.ORANGE);
if (isShot = true) {
shoot();
}
isShot= true;
Main.HealthEnemy --;
System.out.println("Enemy Health is " + 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
System.exit(0);
......@@ -106,7 +113,10 @@ enemyTurn();
setFill(Color.BLUE);
//Orange shows a hit, whereas Blue represents a miss
if (isShot = true) {
shoot();
}
isShot = true;
enemyTurn();
}
......@@ -301,9 +311,10 @@ enemyTarget = Main.BoardPlayer.getCell(ComputerX, ComputerY); //Sets the compute
if (enemyTarget.isShip) {
enemyTarget.setFill(Color.ORANGE);
if (Cell.isShotEnemy = true) {
enemyTurn();
}
Main.HealthPlayer --;
System.out.println("Player Health is " + Main.HealthPlayer);
......
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