From da29b64e49ca505c69b5b593ab801eb1110e4929 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Sat, 8 Feb 2025 14:01:47 -0600 Subject: [PATCH] apply tile effec ton capture --- Systems/Game/ChessGame.gd | 7 ++++--- Systems/StateMachine/GameStates/Movement.gd | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) 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