draw_line

main
Just Dzhi 2023-10-01 16:51:02 +04:00
parent 58553d00b6
commit 6df4533c28
1 changed files with 5 additions and 0 deletions

View File

@ -69,3 +69,8 @@ func _shoot():
get_parent().add_child(bullet_instance) get_parent().add_child(bullet_instance)
bullet_instance.global_position.x = get_node("../Player").global_position.x + 12 bullet_instance.global_position.x = get_node("../Player").global_position.x + 12
bullet_instance.global_position.y = get_node("../Player").global_position.y - 4 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