Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | thomasLio |
I finished a mouse-click path finder to a little isometric game I’m trying to make, but then I added a Camera2D and the path just get messy when the camera moves.
I’m sure it’s the camera because if I delete it everything comes back to normal.
Here is the code in GDScript that generates the path
extends Node2D
onready var nav2D = $Navigation2D
onready var charact = $Character
onready var line = $Line2D
func _input(event):
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.is_pressed():
var clickPosi = event.global_position
var charPosi = charact.global_position
var path = nav2D.get_simple_path(charPosi, clickPosi)
line.points = path
charact.path = path
charact.move()