Skip to content
Snippets Groups Projects
Commit 33869ee6 authored by Alan's avatar Alan
Browse files

Pieces now move out to the left when captured

parent 3c25ddfa
No related branches found
No related tags found
No related merge requests found
......@@ -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"
}
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment