diff --git a/Systems/Game/ChessGame.gd b/Systems/Game/ChessGame.gd index 41f958d..69f363e 100644 --- a/Systems/Game/ChessGame.gd +++ b/Systems/Game/ChessGame.gd @@ -157,15 +157,16 @@ func clearSelection() : -func updatePointsAndCapture(capturedPiece: Pawn) -> void: +func updatePointsAndCapture(capturedPiece: Pawn, animate: bool = true) -> void: if Turn == 0: p1Points += capturedPiece.Points p1String.text = str(p1Points) else: p2Points += capturedPiece.Points p2String.text = str(p2Points) - - animatePieceCapture(capturedPiece) + + if animate: + animatePieceCapture(capturedPiece) if capturedPiece.name == "King": diff --git a/Systems/StateMachine/GameStates/Movement.gd b/Systems/StateMachine/GameStates/Movement.gd index 166b25c..b5cc0d6 100644 --- a/Systems/StateMachine/GameStates/Movement.gd +++ b/Systems/StateMachine/GameStates/Movement.gd @@ -221,8 +221,12 @@ func handleCapture(node: PieceContainer) -> void: var captured_piece = node.get_piece() if moving_piece && captured_piece: - game.updatePointsAndCapture(captured_piece) + await game.animatePieceCapture(captured_piece) + game.updatePointsAndCapture(captured_piece, false) node.animate_movement(source_container, moving_piece); + var tile = game.tileManager.get_tile(node.name) + if tile: + tile.apply_effect(moving_piece) game.currentlyMovingPiece = moving_piece