Fixed turret rotation for y-wing, added test function for attacking, do not run as asset for blaster bolts is not added it WILL Crash!
This commit is contained in:
@@ -54,14 +54,18 @@ position = Vector2(0, 21)
|
|||||||
position = Vector2(0, -1)
|
position = Vector2(0, -1)
|
||||||
target_position = Vector2(-1, 873)
|
target_position = Vector2(-1, 873)
|
||||||
collision_mask = 11
|
collision_mask = 11
|
||||||
|
collide_with_areas = true
|
||||||
|
|
||||||
[node name="refire_timer1" type="Timer" parent="."]
|
[node name="refire_timer1" type="Timer" parent="."]
|
||||||
|
wait_time = 5.0
|
||||||
|
|
||||||
[node name="refire_timer2" type="Timer" parent="."]
|
[node name="refire_timer2" type="Timer" parent="."]
|
||||||
|
wait_time = 5.0
|
||||||
|
|
||||||
[node name="death_timer" type="Timer" parent="."]
|
[node name="death_timer" type="Timer" parent="."]
|
||||||
wait_time = 0.5
|
wait_time = 0.5
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
[connection signal="timeout" from="refire_timer1" to="." method="_on_refire_timer_1_timeout"]
|
[connection signal="timeout" from="refire_timer1" to="." method="_on_refire_timer_1_timeout"]
|
||||||
|
[connection signal="timeout" from="refire_timer2" to="." method="_on_refire_timer_2_timeout"]
|
||||||
[connection signal="timeout" from="death_timer" to="." method="_on_death_timer_timeout"]
|
[connection signal="timeout" from="death_timer" to="." method="_on_death_timer_timeout"]
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ var Laser = preload("res://Scenes/PlayerLaser.tscn")
|
|||||||
var missile = preload("res://Scenes/missile.tscn")
|
var missile = preload("res://Scenes/missile.tscn")
|
||||||
var missile_refil = preload("res://Scenes/missile_pickup.tscn")
|
var missile_refil = preload("res://Scenes/missile_pickup.tscn")
|
||||||
var enemy_laser = preload("res://Scenes/enemy_laser.tscn")
|
var enemy_laser = preload("res://Scenes/enemy_laser.tscn")
|
||||||
|
|
||||||
|
var enemy_y_wing_turret_laser = null
|
||||||
|
var enemy_y_wing_main_laser = null
|
||||||
@onready var player = $player
|
@onready var player = $player
|
||||||
|
|
||||||
#mixed variables for hud
|
#mixed variables for hud
|
||||||
@@ -57,7 +60,11 @@ func fire_enemy_laser(location):
|
|||||||
e.global_position = location
|
e.global_position = location
|
||||||
add_child(e)
|
add_child(e)
|
||||||
|
|
||||||
|
func firey_wingturret(location,rotation,target):
|
||||||
|
print(str(rotation))
|
||||||
|
print(str(target))
|
||||||
|
var l = enemy_y_wing_turret_laser.initialize(rotation,target)
|
||||||
|
l.global_position = location
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ var main_cannon = true
|
|||||||
#can turret fire? (rate of fire control)
|
#can turret fire? (rate of fire control)
|
||||||
var turret_cannon = true
|
var turret_cannon = true
|
||||||
var firing_solution = null
|
var firing_solution = null
|
||||||
|
var target_area = null
|
||||||
|
|
||||||
|
|
||||||
#reset raycast, setup settings
|
#reset raycast, setup settings
|
||||||
@@ -49,10 +50,11 @@ func _physics_process(delta):
|
|||||||
mainCannonFire.start()
|
mainCannonFire.start()
|
||||||
aim_turret(delta)
|
aim_turret(delta)
|
||||||
|
|
||||||
if target_ray.is_colliding() and target_ray.get_colldier() is player:
|
if target_ray.is_colliding and target_ray.get_collider() is player:
|
||||||
if turret_cannon == true:
|
if turret_cannon == true:
|
||||||
fire_turret(firing_solution)
|
fire_turret(turret_muzzle,firing_solution,target_area)
|
||||||
turret_timer.start()
|
turret_timer.start()
|
||||||
|
turret_cannon = false
|
||||||
|
|
||||||
#func aim_turret(delta):
|
#func aim_turret(delta):
|
||||||
#var target : Vector2 = player.global_position
|
#var target : Vector2 = player.global_position
|
||||||
@@ -86,9 +88,10 @@ func aim_turret(delta):
|
|||||||
#turret.set_rotation(atan2(turret_pos.x - target.x, turret_pos.y - target_pos.y))
|
#turret.set_rotation(atan2(turret_pos.x - target.x, turret_pos.y - target_pos.y))
|
||||||
turret.set_rotation(atan2(target.y - turret_pos.y, target.x - turret_pos.x)-90*(PI/180))
|
turret.set_rotation(atan2(target.y - turret_pos.y, target.x - turret_pos.x)-90*(PI/180))
|
||||||
firing_solution = atan2(target.y - turret_pos.y, target.x - turret_pos.x)-90*(PI/180)
|
firing_solution = atan2(target.y - turret_pos.y, target.x - turret_pos.x)-90*(PI/180)
|
||||||
|
target_area = target_pos
|
||||||
|
|
||||||
func fire_turret(rotation):
|
func fire_turret(location,rotation,target_area):
|
||||||
pass
|
get_tree().current_scene.firey_wingturret(location,rotation,target_area)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -127,3 +130,7 @@ func _on_death_timer_timeout():
|
|||||||
func _on_area_entered(area):
|
func _on_area_entered(area):
|
||||||
if area is player:
|
if area is player:
|
||||||
area.take_damage(1)
|
area.take_damage(1)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_refire_timer_2_timeout():
|
||||||
|
turret_cannon = true
|
||||||
|
|||||||
Reference in New Issue
Block a user