forked from JavaCrips/BattleShip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.java
54 lines (48 loc) · 1.21 KB
/
Cell.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package battleship;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
public class Cell extends Rectangle {
public int x, y;
public Ship ship = null;
public boolean wasShot = false;
private Board board;
/**
*
* @param x
* @param y
* @param board
* @since version 0.1.1
* @author Brandon
*
* default cell constructor.
*/
public Cell(int x, int y, Board board) {
super(30, 30);
this.x = x;
this.y = y;
this.board = board;
setFill(Color.LIGHTGRAY);
setStroke(Color.BLACK);
}
/**
*
* @param x
* @param y
* @param board any board that is using this cell.
* @param f just used to differentiate from the other constructor.
* @see Board
* @since version 0.2.2
* @author Elijah Joshua Mamon
*
* This cell method changes the cell to green instead when called.
*
*/
public Cell(int x, int y, Board board, boolean f) {
super(30, 30);
this.x = x;
this.y = y;
this.board = board;
setFill(Color.GREEN);
setStroke(Color.BLACK);
}
}