Better take visualization & Pawn bugfix
This commit is contained in:
parent
920c4e76e4
commit
8186124030
|
@ -133,6 +133,7 @@ public class Chessboard extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
g2.setStroke(new BasicStroke(10));
|
||||
for(int i=0; i<SQUARE_COUNT; i++) {
|
||||
for(int j=0; j<SQUARE_COUNT; j++) {
|
||||
if(lastMove != null && lastMove[j][i]) {
|
||||
|
@ -145,7 +146,8 @@ public class Chessboard extends JPanel {
|
|||
g2.setTransform(beforeSquares);
|
||||
g2.translate(i*SQUARE_SIZE, j*SQUARE_SIZE);
|
||||
g2.setColor(new Color(0, 0, 0, 40));
|
||||
g2.fillOval(35, 35, 30, 30);
|
||||
if(pieces[j][i] == null) g2.fillOval(35, 35, 30, 30);
|
||||
else g2.drawRect(5, 5, 90, 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Pawn extends AbstractPiece {
|
|||
boolean isPieceThere = chessboard.getPiece(new PiecePosition(x+i, y+directionY)) != null;
|
||||
if((i != 0 && (theoretical || isPieceThere)) || (i == 0 && (!theoretical && !isPieceThere))) setPossibleMove(moves, x+i, y+directionY);
|
||||
}
|
||||
if(moveCount == 0 && chessboard.getPiece(new PiecePosition(x, y+directionY)) == null) setPossibleMove(moves, x, y + directionY*2);
|
||||
if(moveCount == 0 && chessboard.getPiece(new PiecePosition(x, y+directionY*2)) == null) setPossibleMove(moves, x, y + directionY*2);
|
||||
return moves;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue