Fix Waves' Angles
parent
dc3af8c23a
commit
7afd0874e8
|
@ -53,6 +53,7 @@ func _physics_process(delta):
|
||||||
|
|
||||||
func _shoot():
|
func _shoot():
|
||||||
sonic_wave = sonic_wave_preload.instance()
|
sonic_wave = sonic_wave_preload.instance()
|
||||||
|
sonic_wave.angle = global_position.angle_to_point(player.global_position)
|
||||||
get_parent().add_child(sonic_wave)
|
get_parent().add_child(sonic_wave)
|
||||||
sonic_wave.global_position.x = self.global_position.x + 8
|
sonic_wave.global_position.x = self.global_position.x + 8
|
||||||
sonic_wave.global_position.y = self.global_position.y + 8
|
sonic_wave.global_position.y = self.global_position.y + 8
|
||||||
|
|
|
@ -5,9 +5,6 @@ var speed = 120
|
||||||
onready var player = $"../../Player"
|
onready var player = $"../../Player"
|
||||||
var angle
|
var angle
|
||||||
|
|
||||||
func _ready():
|
|
||||||
angle = global_position.angle_to_point(player.global_position)
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
$Sprite.rotation_degrees = rad2deg(angle + PI)
|
$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)
|
||||||
|
|
Loading…
Reference in New Issue