2024-06-03 05:29:11 -04:00
|
|
|
extends Node2D
|
|
|
|
|
|
2024-06-03 05:53:12 -04:00
|
|
|
#this is a minor change to update the repo.
|
2024-06-03 05:29:11 -04:00
|
|
|
#asset preloading
|
|
|
|
|
var Laser = preload("res://Scenes/PlayerLaser.tscn")
|
|
|
|
|
var missile = preload("res://Scenes/missile.tscn")
|
|
|
|
|
var missile_refil = preload("res://Scenes/missile_pickup.tscn")
|
|
|
|
|
var enemy_laser = preload("res://Scenes/enemy_laser.tscn")
|
2024-06-05 05:31:51 -04:00
|
|
|
|
|
|
|
|
var enemy_y_wing_turret_laser = null
|
|
|
|
|
var enemy_y_wing_main_laser = null
|
2024-06-03 05:29:11 -04:00
|
|
|
@onready var player = $player
|
|
|
|
|
|
|
|
|
|
#mixed variables for hud
|
|
|
|
|
var score = 0
|
|
|
|
|
var max_health = 3
|
|
|
|
|
var missiles_total = 3
|
|
|
|
|
var missiles_current = 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_player_spawn_laser(location):
|
|
|
|
|
var l = Laser.instantiate()
|
|
|
|
|
l.global_position = location
|
|
|
|
|
add_child(l)
|
|
|
|
|
|
|
|
|
|
func _on_player_spawn_missile(location):
|
|
|
|
|
var m = missile.instantiate()
|
|
|
|
|
m.global_position = location
|
|
|
|
|
add_child(m)
|
|
|
|
|
missiles_current -= 1
|
|
|
|
|
$missile_count.text = "Missiles:" + "\n" + str(missiles_current) + "/" + str(missiles_total)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func missile_spawn(location):
|
|
|
|
|
#print(str(location.global_position))
|
|
|
|
|
var m = missile_refil.instantiate()
|
|
|
|
|
m.global_position = location
|
|
|
|
|
add_child(m)
|
|
|
|
|
|
|
|
|
|
func missile_container():
|
|
|
|
|
#print("signal recieved")
|
|
|
|
|
$player.refil_missiles()
|
|
|
|
|
missiles_current = 3
|
|
|
|
|
$missile_count.text = "Missiles:" + "\n" + str(missiles_current) + "/" + str(missiles_total)
|
|
|
|
|
|
|
|
|
|
func player_health(current_health):
|
|
|
|
|
var thing = current_health * 100 / max_health
|
|
|
|
|
var display = $health
|
|
|
|
|
display.text = "Hull Integrity" + "\n" + str(thing) + "%"
|
|
|
|
|
|
|
|
|
|
func scored():
|
|
|
|
|
score += 10
|
|
|
|
|
$Score.text = "Score: " + str(score)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func fire_enemy_laser(location):
|
|
|
|
|
var e = enemy_laser.instantiate()
|
|
|
|
|
e.global_position = location
|
|
|
|
|
add_child(e)
|
|
|
|
|
|
2024-06-05 05:31:51 -04:00
|
|
|
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
|
2024-06-03 05:29:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|