fuzzyworld

godot-shooter / commit

Fix navigation on mobile.

ded27fa11f8307216667b40d38db9529266199c9 · Pavel Safronov · 2023-11-05 16:52:51 -0800 · parents 52220002a7c8

Fix navigation on mobile.
 World.gd | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/World.gd b/World.gd
index 69717cd..1c5de5c 100644
--- a/World.gd
+++ b/World.gd
@@ -33,7 +33,9 @@ func _input(event: InputEvent) -> void:
 		if event.pressed && !$Player.dead:
 			Utils.log("event position", event.position)
 			Utils.log("to_global(event.position)", to_global(event.position))
-			set_destination(to_global(event.position))
+			Utils.log("player", $Player.position)
+			var result = event.position + $Player.position - Vector2(500, 300)
+			set_destination(result)
 
 func _process(_delta: float) -> void:
 	if Input.is_action_just_pressed("click") and !$Player.dead: