extends TileMap
var astar = AStarGrid2D.new()func _ready() -> void: astar.region = Rect2i(0, 0, 1920, 1080) astar.size = Vector2i(1920, 1080) astar.cell_size = Vector2i(128, 128) astar.default_compute_heuristic = AStarGrid2D.HEURISTIC_MANHATTAN astar.default_estimate_heuristic = AStarGrid2D.HEURISTIC_MANHATTAN astar.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_NEVER astar.update()
func _input(event: InputEvent) -> void: if event.is_action_pressed("a"): print(local_to_map(get_global_mouse_position())) var coord_path = astar.get_id_path(Vector2(1,1),local_to_map(get_global_mouse_position())) print(coord_path)
var astar = AStarGrid2D.new()func _ready() -> void: astar.region = Rect2i(0, 0, 1920, 1080) astar.size = Vector2i(1920, 1080) astar.cell_size = Vector2i(128, 128) astar.default_compute_heuristic = AStarGrid2D.HEURISTIC_MANHATTAN astar.default_estimate_heuristic = AStarGrid2D.HEURISTIC_MANHATTAN astar.diagonal_mode = AStarGrid2D.DIAGONAL_MODE_NEVER astar.update()
func _input(event: InputEvent) -> void: if event.is_action_pressed("a"): print(local_to_map(get_global_mouse_position())) var coord_path = astar.get_id_path(Vector2(1,1),local_to_map(get_global_mouse_position())) print(coord_path)