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:
zerothelootrat
2024-06-05 05:31:51 -04:00
parent f8a23dbd96
commit 7f061935af
3 changed files with 23 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ var main_cannon = true
#can turret fire? (rate of fire control)
var turret_cannon = true
var firing_solution = null
var target_area = null
#reset raycast, setup settings
@@ -49,10 +50,11 @@ func _physics_process(delta):
mainCannonFire.start()
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:
fire_turret(firing_solution)
fire_turret(turret_muzzle,firing_solution,target_area)
turret_timer.start()
turret_cannon = false
#func aim_turret(delta):
#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(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):
pass
func fire_turret(location,rotation,target_area):
get_tree().current_scene.firey_wingturret(location,rotation,target_area)
@@ -127,3 +130,7 @@ func _on_death_timer_timeout():
func _on_area_entered(area):
if area is player:
area.take_damage(1)
func _on_refire_timer_2_timeout():
turret_cannon = true