Looking at the Godot documentation, I found a code to move towards mouse click:
func _physics_process(delta):
velocity = global_position.direction_to(target) * speed
if global_position.distance_to(target) > 5:
velocity = move_and_slide(velocity)
I'm stuck on how to get the object to continuously move in that direction. Like if I click somewhere to the right of the player, I want the player to have constant velocity towards where I clicked and not stop. Any suggestions? Thank you!