OOP_1B2_Project/src/backend/Piece.java

58 lines
901 B
Java

package backend;
public class Piece {
private int x;
private int y;
private PieceType type;
private boolean color;
private boolean hasMoved;
public Piece(PieceType type_P, boolean color_P, int xP, int yP) {
x = xP;
y = yP;
type = type_P;
color = color_P;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public PieceType getType() {
return type;
}
public boolean isWhite() {
return color;
}
public boolean hasMoved() {
return hasMoved;
}
public void setHasMoved(boolean moved) {
this.hasMoved = moved;
}
public String getName() {
if(color) {
return type.getSummary().concat("W - ");
}
else {
return type.getSummary().concat("B - ");
}
}
}