diff --git a/Systems/Cards/Drunkdriving.gd b/Systems/Cards/Drunkdriving.gd index f4fc7b7..1468dec 100644 --- a/Systems/Cards/Drunkdriving.gd +++ b/Systems/Cards/Drunkdriving.gd @@ -41,12 +41,11 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): var tile_y = int(tile_name.split("-")[1]) final_y = tile_y - y_direction break + print("CHECKING TILES ", tiles_to_check) # Process pieces in path for tile_name in tiles_to_check: var tile_y = int(tile_name.split("-")[1]) # Only process tiles up to where we're stopping - if (y_direction > 0 && tile_y > final_y) || (y_direction < 0 && tile_y < final_y): - break var container = board_flow.get_node(tile_name) as PieceContainer if container.has_piece(): @@ -54,7 +53,9 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): game_state.updatePointsAndCapture(piece_to_capture) # Move piece to final position + print("FINAL TILES ", str(current_x) + "-" + str(final_y)) var final_container = board_flow.get_node(str(current_x) + "-" + str(final_y)) as PieceContainer + print("FINAL TILES ", final_container.get_piece().Item_Color) # Important: Need to remove the piece from its current container first # AND keep a reference to it diff --git a/Systems/Game/ChessGame.gd b/Systems/Game/ChessGame.gd index 69f363e..ec4cb2b 100644 --- a/Systems/Game/ChessGame.gd +++ b/Systems/Game/ChessGame.gd @@ -164,7 +164,6 @@ func updatePointsAndCapture(capturedPiece: Pawn, animate: bool = true) -> void: else: p2Points += capturedPiece.Points p2String.text = str(p2Points) - if animate: animatePieceCapture(capturedPiece) diff --git a/Systems/StateMachine/GameStates/Movement.gd b/Systems/StateMachine/GameStates/Movement.gd index b5cc0d6..b6fce12 100644 --- a/Systems/StateMachine/GameStates/Movement.gd +++ b/Systems/StateMachine/GameStates/Movement.gd @@ -9,7 +9,6 @@ func _ready() -> void: func enter(_previous: String, _data := {}) -> void: print("ENTERING STATE ", Constants.MOVEMENT) if !game.boardContainer.is_connected("tile_pressed", handleMovement): - print("Connecting tile_pressed signal") game.boardContainer.connect("tile_pressed", handleMovement) if game.selectedNode != "": game.getMovableAreas() @@ -41,7 +40,7 @@ func handleMovement(location: String) -> void: # we need to prevent swapping of focus between peices after the double move process has started # maybe once u start nmoving a peice global stat var is set # and any moving peice needs ot match that - print("HANDLING MOVEMENT ", location, " | ", multiMoving, " | ", game.selectedNode) + # print("HANDLING MOVEMENT ", location, " | ", multiMoving, " | ", game.selectedNode) var node = game.get_node("Flow/" + location) as PieceContainer # Only try to get piece if we have a selected node diff --git a/Systems/Tiles/FireWall.gd b/Systems/Tiles/FireWall.gd index 7d2ac0a..8a0ea0d 100644 --- a/Systems/Tiles/FireWall.gd +++ b/Systems/Tiles/FireWall.gd @@ -13,8 +13,6 @@ func apply_effect(piece: Pawn = null) -> void: if piece && is_effect_active(): # Only affect enemy pieces based on tile owner var is_enemy = false - print("--------___CHECKING FIREWALL") - print(tile_owner, " ", piece.Item_Color) match tile_owner: TileOwner.PLAYER: # White print("PLAYER OWNER") diff --git a/addons/Chess/Scripts/Knight.gd b/addons/Chess/Scripts/Knight.gd index 9d79256..244ac33 100644 --- a/addons/Chess/Scripts/Knight.gd +++ b/addons/Chess/Scripts/Knight.gd @@ -87,3 +87,36 @@ func getValidMoves(board_flow, current_location: String) -> Dictionary: return moves +func animate_movement(target_position: Vector2, duration: float = 0.5) -> void: + z_index = 1 + var tween = create_tween() + tween.set_trans(Tween.TRANS_LINEAR) + tween.set_ease(Tween.EASE_IN_OUT) + + var start_pos = global_position + var total_delta = target_position - start_pos + var mid_pos: Vector2 + + var cell_delta_x = int(total_delta.x / 50) + var cell_delta_y = int(total_delta.y / 50) + + if abs(cell_delta_x) > abs(cell_delta_y): + # Moving more horizontally ([-2, ±1]) + mid_pos = Vector2( + start_pos.x + (cell_delta_x * 50), + start_pos.y + ) + else: + # Moving more vertically ([±1, -2]) + mid_pos = Vector2( + start_pos.x, + start_pos.y + (cell_delta_y * 50) + ) + + # First move (longer distance) + tween.tween_property(self, "global_position", mid_pos, duration/2) + # Second move (shorter distance) + tween.tween_property(self, "global_position", target_position, duration/2) + + await tween.finished + z_index = 0 \ No newline at end of file diff --git a/addons/Chess/Scripts/Pawn.gd b/addons/Chess/Scripts/Pawn.gd index 01e3b3a..b74ea29 100644 --- a/addons/Chess/Scripts/Pawn.gd +++ b/addons/Chess/Scripts/Pawn.gd @@ -138,7 +138,7 @@ func can_move_to_cell(board_flow, location: String, is_capture: bool = false) -> return piece != null && piece.Item_Color != self.Item_Color return !container.has_piece() -func animate_movement(target_position: Vector2, duration: float = 1) -> void: +func animate_movement(target_position: Vector2, duration: float = 0.5) -> void: # print("--------------STARTING ANIM--------------", position, " ", target_position) z_index = 1 var tween = create_tween()