Files

83 lines
2.0 KiB
GDScript3
Raw Permalink Normal View History

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")
var enemy_y_wing_main = preload("res://Scenes/y_wing_main_cannon_laser.tscn")
2024-06-05 17:37:46 -04:00
var enemy_y_wing_turret_laser = preload("res://Scenes/turret_laser.tscn")
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 17:37:46 -04:00
func firey_wingturret(location,firing_solution,target):
var l = enemy_y_wing_turret_laser.instantiate()
l.global_position = location
2024-06-05 17:37:46 -04:00
l.initialize(firing_solution,target)
#print(str(firing_solution))
add_child(l)
#l.initialize(rotation,target)
2024-06-03 05:29:11 -04:00
func fire_y_wing_main(location):
print("fired")
var l = enemy_y_wing_main.instantiate()
l.global_position = location
add_child(l)
2024-06-03 05:29:11 -04:00