Fronter/Mothership.gd

45 lines
999 B
GDScript

extends Area2D
signal game_over
export (PackedScene) var Laser
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var health = 1000
var double_laser = false
var can_shoot = true
var timer = null
var bullet_delay = 0.1
func _ready():
timer = Timer.new()
timer.set_one_shot(true)
timer.set_wait_time(bullet_delay)
timer.connect("timeout", self, "on_timeout_complete")
add_child(timer)
func _process(delta):
if health <= 0:
emit_signal("game_over")
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass
func _on_GunAimNode_area_entered(area):
for i in range(20):
#var laser = Laser.instance()
#get_node("../").add_child(laser)
#laser.position.y = position.y - 27
#laser.position.x = position.x + 46
if double_laser == true:
var laser2 = Laser.instance()
get_node("../").add_child(laser2)
laser2.position.y = position.y + 28
laser2.position.x = position.x + 46
can_shoot = false
timer.start()