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)