This commit is contained in:
loveb
2022-03-31 09:15:35 +02:00
parent 4f77dc0b33
commit 507315cefe
5 changed files with 45 additions and 32 deletions

View File

@@ -20,6 +20,8 @@ public class Board extends JPanel implements MouseListener {
private Point selectedPiece = new Point();
private Color moveableColor = new Color(255, 191, 0);
private boolean turn = true;
private LinkedHashSet<Point> whiteAttacks = new LinkedHashSet<>();
private LinkedHashSet<Point> blackAttacks = new LinkedHashSet<>();
public Board() throws IOException {
@@ -129,6 +131,8 @@ public class Board extends JPanel implements MouseListener {
if (p.isWhite() == turn) {
LinkedHashSet validMoves = p.validMoves(pieces);
validMovesToDraw.addAll(validMoves);
}
} catch (Exception e) {
validMovesToDraw.clear();