-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTile.java
More file actions
30 lines (21 loc) · 732 Bytes
/
Tile.java
File metadata and controls
30 lines (21 loc) · 732 Bytes
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
package Checkers;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
public class Tile extends Rectangle {
private Piece piece;
public boolean hasPiece(){
return piece!= null;
}
public Piece getPiece(){
return piece;
}
public void setPiece(Piece piece) {
this.piece = piece;
}
public Tile(boolean light, int x, int y){
setWidth(CheckerBoard.TILE_SIZE); //javaFx design of the tiles that make up the board
setHeight(CheckerBoard.TILE_SIZE);
relocate(x * CheckerBoard.TILE_SIZE, y * CheckerBoard.TILE_SIZE);
setFill(light ? Color.valueOf("#feb") : Color.valueOf("#582")); //arbitrary colors of the board
}
}