From 6df4533c284eb19ea3277a0b1944aaa82bdd8426 Mon Sep 17 00:00:00 2001 From: Just Dzhi Date: Sun, 1 Oct 2023 16:51:02 +0400 Subject: [PATCH] draw_line --- src/models/player/player.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/models/player/player.gd b/src/models/player/player.gd index af0b281..33233f2 100644 --- a/src/models/player/player.gd +++ b/src/models/player/player.gd @@ -69,3 +69,8 @@ func _shoot(): get_parent().add_child(bullet_instance) bullet_instance.global_position.x = get_node("../Player").global_position.x + 12 bullet_instance.global_position.y = get_node("../Player").global_position.y - 4 + +func _draw(): + var distance_2_enemy = position.distance_to(Vector2(100, 100)) + draw_line(Vector2(12, 8), Vector2(distance_2_enemy * cos(self.global_position.x), distance_2_enemy * sin(self.global_position.y)), Color(255, 255, 255)) + #TODO replace self.global_position.x,y to enemy x,y