From 7afd0874e8c21404fea73346d43430917115883a Mon Sep 17 00:00:00 2001 From: Luna Brovchuk Date: Sun, 1 Oct 2023 22:28:47 +0200 Subject: [PATCH] Fix Waves' Angles --- src/models/enemies/bat/bat.gd | 1 + src/models/sonic_wave/Sonic_Wave.gd | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/models/enemies/bat/bat.gd b/src/models/enemies/bat/bat.gd index 0d1a8b9..8df845c 100644 --- a/src/models/enemies/bat/bat.gd +++ b/src/models/enemies/bat/bat.gd @@ -53,6 +53,7 @@ func _physics_process(delta): func _shoot(): sonic_wave = sonic_wave_preload.instance() + sonic_wave.angle = global_position.angle_to_point(player.global_position) get_parent().add_child(sonic_wave) sonic_wave.global_position.x = self.global_position.x + 8 sonic_wave.global_position.y = self.global_position.y + 8 diff --git a/src/models/sonic_wave/Sonic_Wave.gd b/src/models/sonic_wave/Sonic_Wave.gd index a2f3653..5e44f09 100644 --- a/src/models/sonic_wave/Sonic_Wave.gd +++ b/src/models/sonic_wave/Sonic_Wave.gd @@ -5,9 +5,6 @@ var speed = 120 onready var player = $"../../Player" var angle -func _ready(): - angle = global_position.angle_to_point(player.global_position) - func _physics_process(delta): $Sprite.rotation_degrees = rad2deg(angle + PI) - move_and_slide(Vector2(speed, 0).rotated(angle + PI)) + move_and_collide(Vector2(speed, 0).rotated(angle + PI) * delta)