implement check sound

This commit is contained in:
samuelsmith 2025-05-07 16:30:35 +02:00
parent e9f00ec16f
commit c0bd2ed502
2 changed files with 5 additions and 1 deletions

View File

@ -208,6 +208,9 @@ public class Board {
if (movedPiece != null) {
movedPiece.setMoved(true);
}
if (kingCheck.isKingInCheck(board,turnColor) || kingCheck.isKingInCheck(board,!turnColor)) {
soundEffect.checkSound();
}
}
}
@ -251,6 +254,7 @@ public class Board {
if (board.get(y).get(x).getType() == PieceType.King && board.get(y).get(x).isWhite == turnColor){
if (kingCheck.isKingInCheck(board,turnColor)) {
out = true;
}
}
}

View File

@ -1,8 +1,8 @@
package backend;
import java.util.ArrayList;
public class KingCheck {
private SoundEffect soundEffect = new SoundEffect ();
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);