I am trying to have player walk towards a destination defined by the click of the mouse.
But although the coordinates of the input even and the points seem to be right
The path followed is all wrong.
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
path = $Navigation2D.get_simple_path($Player.position, event.position)
$Player.path = path
$Line2D.points = path
print(path.size(), ' Path:',path, ' Player:', $Player.position, ' Target:', event.position)
update() # so line and circles get drawn
for p in path:
draw_circle(p, 5, Color(200, 200, 200))
Very minimal demo here
Any help appreciated!