Constructor Piece
This commit is contained in:
parent
970c7f540a
commit
da627552b5
|
|
@ -1,21 +1,40 @@
|
|||
package backend;
|
||||
|
||||
public class Piece {
|
||||
private int x;
|
||||
private int y;
|
||||
private ChessPieceType type;
|
||||
private boolean isWhite;
|
||||
|
||||
public int getX() {
|
||||
return 0;
|
||||
}
|
||||
public Piece(int x, int y, ChessPieceType type, boolean isWhite) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.type = type;
|
||||
this.isWhite = isWhite; // true if the piece is white, false if black
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public PieceType getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isWhite() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public ChessPieceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isWhite() {
|
||||
return isWhite; // Returns true if the piece is white, false if black
|
||||
}
|
||||
}
|
||||
|
||||
enum ChessPieceType {
|
||||
Pawn,
|
||||
Rook,
|
||||
Knight,
|
||||
Bishop,
|
||||
Queen,
|
||||
King
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue