implement check sound
This commit is contained in:
parent
e9f00ec16f
commit
c0bd2ed502
|
|
@ -208,6 +208,9 @@ public class Board {
|
||||||
if (movedPiece != null) {
|
if (movedPiece != null) {
|
||||||
movedPiece.setMoved(true);
|
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 (board.get(y).get(x).getType() == PieceType.King && board.get(y).get(x).isWhite == turnColor){
|
||||||
if (kingCheck.isKingInCheck(board,turnColor)) {
|
if (kingCheck.isKingInCheck(board,turnColor)) {
|
||||||
out = true;
|
out = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package backend;
|
package backend;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class KingCheck {
|
public class KingCheck {
|
||||||
|
private SoundEffect soundEffect = new SoundEffect ();
|
||||||
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
|
public ArrayList<ArrayList<Boolean>> getLegalMoves(Piece piece, ArrayList<ArrayList<Piece>> board, Move lastMove) {
|
||||||
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);
|
ArrayList<ArrayList<Boolean>> rawMoves = piece.getPossibleMoves(board,lastMove);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue