extends Piece class_name King enum Upgrade { # Add any specific upgrades for King here } func _init(is_white_param: bool, position_param: Vector2): super._init(is_white_param, position_param) func get_valid_moves(board_state: Array, pos: Vector2) -> Array[Vector2]: var valid_moves: Array[Vector2] = [] var x = pos.x var y = pos.y # TODO: STILL NEEDS TO IMPLEMENT CASTLING # TODO: STILL NEEDS TO IMPLEMENT CHECKING FOR CHECK # Check moves in all directions (one square) var directions = [ Vector2(1, 0), Vector2(-1, 0), Vector2(0, 1), Vector2(0, -1), # Cardinal directions Vector2(1, 1), Vector2(-1, -1), Vector2(1, -1), Vector2(-1, 1) # Diagonal directions ] for direction in directions: var new_x = x + direction.x var new_y = y + direction.y if new_x >= 0 and new_x < 8 and new_y >= 0 and new_y < 8: if board_state[new_x][new_y] == null or board_state[new_x][new_y].is_white != is_white: valid_moves.append(Vector2(new_x, new_y)) return valid_moves