Fix bug that would not allow a piece move if you tried to take an opponents piece.
This commit is contained in:
parent
5bb658ca0f
commit
ff34e052dc
@ -27,12 +27,12 @@ class TapBloc extends Bloc<TapEvent, TapState> {
|
|||||||
ChessPiece? piece;
|
ChessPiece? piece;
|
||||||
|
|
||||||
if (ChessBloc.myColor != ChessBloc.turnColor) return;
|
if (ChessBloc.myColor != ChessBloc.turnColor) return;
|
||||||
if (event.pieceOnSquare != null &&
|
|
||||||
ChessBloc.myColor != event.pieceOnSquare!.color) return;
|
|
||||||
|
|
||||||
if (state.firstSquareTapped == null) {
|
if (state.firstSquareTapped == null) {
|
||||||
//first tap
|
//first tap
|
||||||
if (event.pieceOnSquare == null) return;
|
if (event.pieceOnSquare == null) return;
|
||||||
|
if (event.pieceOnSquare != null &&
|
||||||
|
ChessBloc.myColor != event.pieceOnSquare!.color) return;
|
||||||
firstTappedSquare = event.tapped;
|
firstTappedSquare = event.tapped;
|
||||||
piece = event.pieceOnSquare;
|
piece = event.pieceOnSquare;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user