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)
![](http://tiebapic.baidu.com/forum/w%3D580/sign=ee3332a0e20f4bfb8cd09e5c334f788f/62655c4a20a4462365c6f85dde22720e0cf3d74c.jpg?tbpicau=2024-08-06-05_ce98533f39bc05080ed59d2ee1daa29f)