Y wing turret and laser update
This commit is contained in:
@@ -3,6 +3,7 @@ extends Area2D
|
||||
@onready var turret_laser = $Sprite2D
|
||||
|
||||
|
||||
|
||||
var speed = 100
|
||||
var target2 : Vector2
|
||||
var new_rot
|
||||
@@ -10,14 +11,14 @@ func initialize(firing_solution,target):
|
||||
print('firing_solution='+str(firing_solution))
|
||||
new_rot = firing_solution
|
||||
#turret_laser.set_rotation(firing_solution)
|
||||
print(str(turret_laser))
|
||||
print(str(firing_solution))
|
||||
#print(str(turret_laser))
|
||||
#print(str(firing_solution))
|
||||
target2 = target
|
||||
#print(str(firing_solution))
|
||||
|
||||
func _ready():
|
||||
turret_laser.set_rotation(new_rot)
|
||||
$CollisionShape2D.set_rotation(new_rot)
|
||||
set_rotation(new_rot)
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
#print(str(global_position.x - target.x))
|
||||
@@ -26,4 +27,9 @@ func _physics_process(delta):
|
||||
#print(typeof(global_position))
|
||||
#print(typeof(target))
|
||||
global_position -= (global_position - target2).normalized() * speed * delta
|
||||
pass
|
||||
|
||||
|
||||
func _on_area_entered(area):
|
||||
if area is player:
|
||||
area.take_damage(1)
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user