@tool extends Pawn class_name Knight func _ready(): self.texture = load("res://addons/Chess/Textures/WKnight.svg") Points = 3 func _process(_delta): if Item_Color != Temp_Color: Temp_Color = Item_Color if Item_Color == 0: self.texture = load("res://addons/Chess/Textures/WKnight.svg") elif Item_Color == 1: self.texture = load("res://addons/Chess/Textures/BKnight.svg") func get_valid_moves(board_flow, current_location: String) -> Dictionary: var moves = { "regular_moves": [], "special_moves": [] } var loc = current_location.split("-") var x = int(loc[0]) var y = int(loc[1]) # All possible L-shaped moves var knight_moves = [ [-2, -1], [-2, 1], [-1, -2], [-1, 2], [1, -2], [1, 2], [2, -1], [2, 1] ] for move in knight_moves: var new_loc = str(x + move[0]) + "-" + str(y + move[1]) if is_valid_cell(board_flow, new_loc): if can_move_to_cell(board_flow, new_loc) || can_move_to_cell(board_flow, new_loc, true): moves.regular_moves.append(new_loc) return moves