diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index d7d2ae40d679be51916b57f6ad896ec9fad8b1f8..b3cfa14bcef6808601fc5914ff790896d00eebce 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -45,11 +45,15 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 36, +"column": 0, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 52, -"scroll_position": 39.0, -"selection": false, +"row": 10, +"scroll_position": 0.0, +"selection": true, +"selection_from_column": 0, +"selection_from_line": 10, +"selection_to_column": 43, +"selection_to_line": 10, "syntax_highlighter": "GDScript" } diff --git a/scripts/Pawn.gd b/scripts/Pawn.gd index bd1c3047092618d8c54a1c48028dad5e36624cf7..bfd4848e2879f4fd488ab2d0f5c580a9d4b053a8 100644 --- a/scripts/Pawn.gd +++ b/scripts/Pawn.gd @@ -7,8 +7,8 @@ enum Upgrade { DOUBLE_MOVE, DIAGONAL_MOVE } func _init(is_white: bool, position: Vector2): super._init(is_white, position) # Testing upgrades - upgrades.append(Upgrade.DOUBLE_MOVE) - upgrades.append(Upgrade.DIAGONAL_MOVE) + # upgrades.append(Upgrade.DOUBLE_MOVE) + # upgrades.append(Upgrade.DIAGONAL_MOVE) func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]: diff --git a/scripts/Rook.gd b/scripts/Rook.gd index e39a922194023bf7a7eeffba5d509ae04f7382e9..2b53c0fff81a8d41831a77e39016b0177607d9df 100644 --- a/scripts/Rook.gd +++ b/scripts/Rook.gd @@ -8,6 +8,8 @@ enum Upgrade { func _init(is_white: bool, position: Vector2): super._init(is_white, position) + # Testing upgrades + # upgrades.append(Upgrade.DIAGONAL_MOVE_ONE) func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]: var valid_moves: Array[Vector2] = [] @@ -57,5 +59,16 @@ func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]: break else: break + + # Check for DIAGONAL_MOVE_ONE upgrade + if Upgrade.DIAGONAL_MOVE_ONE in upgrades: + if x > 0 and y > 0 and (board_state[x - 1][y - 1] == null or not board_state[x - 1][y - 1].is_white): + valid_moves.append(Vector2(x - 1, y - 1)) + if x < 7 and y > 0 and (board_state[x + 1][y - 1] == null or not board_state[x + 1][y - 1].is_white): + valid_moves.append(Vector2(x + 1, y - 1)) + if x > 0 and y < 7 and (board_state[x - 1][y + 1] == null or not board_state[x - 1][y + 1].is_white): + valid_moves.append(Vector2(x - 1, y + 1)) + if x < 7 and y < 7 and (board_state[x + 1][y + 1] == null or not board_state[x + 1][y + 1].is_white): + valid_moves.append(Vector2(x + 1, y + 1)) return valid_moves