extends Object class_name PathGenerator var map_config : MapGeneratorResource = preload("res://resources/map_generator_resource.tres") func generate_path() -> Array[Vector2i]: var path : Array[Vector2i] var x : int = 0 var y : int = randi_range(1, map_config.grid_height - 3) while x < map_config.grid_width: if not path.has(Vector2i(x,y)): path.append(Vector2i(x, y)) var choice : int = randi_range(0,2) # every even tile goes right to leave room for towers if choice == 0 || x % 2 == 0 || x == map_config.grid_width - 1: x += 1 elif choice == 1 && y < map_config.grid_height - 3 && !path.has(Vector2i(x, y + 1)): y += 1 elif choice == 2 && y > 1 && !path.has(Vector2i(x, y - 1)): y -= 1 return path