diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index a5f5ca27d916bba1137718bef9482dcd3efb7a01..a2b4d40911fe6617b9f8d8abbb9609459da0336c 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -129,11 +129,11 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 38, +"column": 19, "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 113, -"scroll_position": 99.0, +"scroll_position": 95.0, "selection": false, "syntax_highlighter": "GDScript" } diff --git a/scripts/game.gd b/scripts/game.gd index f416dc65a56f1f3c4965ee9d52932c21be1f55e3..1b06578611d203dd2e492571436cfb118d78025f 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -117,7 +117,8 @@ func _process(delta: float) -> void: if selected_piece_value is Pawn: if selected_piece_value.is_white: draw_pieces() - remove_piece(selected_piece_position.x, selected_piece_position.y) + selected_piece.queue_free() + # remove_piece(selected_piece_position.x, selected_piece_position.y) func draw_pieces(): @@ -337,6 +338,32 @@ func remove_piece(x,y): if child.position == Vector2(x*tile_size + 32, y*tile_size + 32): explosion_effect.position = child.position + translate() explosion_effect.restart() + + var piece = child.duplicate() + if is_opponent(x, y): + opponent_piece_count += 1 + if opponent_piece_count <= 4: + piece.position = Vector2(opponent_piece_count - 1, 0) * tile_size + elif opponent_piece_count <= 8: + piece.position = Vector2(opponent_piece_count - 5, 1) * tile_size + elif opponent_piece_count <= 12: + piece.position = Vector2(opponent_piece_count - 9, 2) * tile_size + else: + piece.position = Vector2(opponent_piece_count - 13, 3) * tile_size + opponent_pieces.add_child(piece) + else: + player_piece_count += 1 + if player_piece_count <= 4: + piece.position = Vector2(player_piece_count - 1, 0) * tile_size + elif player_piece_count <= 8: + piece.position = Vector2(player_piece_count - 5, 1) * tile_size + elif player_piece_count <= 12: + piece.position = Vector2(player_piece_count - 9, 2) * tile_size + else: + piece.position = Vector2(player_piece_count - 13, 3) * tile_size + player_pieces.add_child(piece) + + piece_container.remove_child(child) child.queue_free() break