2018-11-12 23:17:53 -05:00
|
|
|
extends "res://Bad.gd"
|
|
|
|
|
2018-11-14 20:36:02 -05:00
|
|
|
signal flash
|
|
|
|
signal boss_health
|
|
|
|
|
2018-11-13 20:53:07 -05:00
|
|
|
var right_laser_alive = true
|
|
|
|
var left_laser_alive = true
|
|
|
|
|
2018-11-12 23:17:53 -05:00
|
|
|
func _ready():
|
|
|
|
speed = 0
|
2018-11-14 20:36:02 -05:00
|
|
|
starting_health = 3000
|
|
|
|
health = starting_health
|
|
|
|
$RightArm/Laser/BadLaser.independent = false
|
2018-11-12 23:17:53 -05:00
|
|
|
#$RightArm/BadLaser.health_multi = 3
|
2018-11-14 20:36:02 -05:00
|
|
|
$LeftArm/Laser/BadLaser.independent = false
|
2018-11-12 23:17:53 -05:00
|
|
|
#$LeftArm/BadLaser.health_multi = 3
|
2018-11-13 20:53:07 -05:00
|
|
|
$RightArm/Laser/BadLaser.fire_speed = 25
|
|
|
|
$LeftArm/Laser/BadLaser.fire_speed = 25
|
|
|
|
$RightArm/Laser/BadLaser/Rotatable.rotation_degrees = -45
|
2018-11-12 23:17:53 -05:00
|
|
|
pass
|
|
|
|
|
|
|
|
func _process(delta):
|
2018-11-13 20:53:07 -05:00
|
|
|
#$RightArm/Forearm.rotate(delta/10)
|
|
|
|
if right_laser_alive:
|
|
|
|
if $RightArm/Laser/BadLaser:
|
2018-11-14 20:36:02 -05:00
|
|
|
#$RightArm/Laser/BadLaser.health -= delta*30
|
2018-11-13 20:53:07 -05:00
|
|
|
if $RightArm/Laser/BadLaser.health <= 100:
|
|
|
|
$RightArm/Laser/BadLaser.fire_speed = 150
|
2018-11-14 20:36:02 -05:00
|
|
|
else:
|
|
|
|
$RightArm/Laser/BadLaser/AnimatedSprite.frame = 1
|
|
|
|
$RightArm/Laser/BadLaser.fire_speed = 0
|
|
|
|
$RightArm/Laser/BadLaser/Line2D.visible = false
|
2018-11-13 20:53:07 -05:00
|
|
|
|
|
|
|
if left_laser_alive:
|
|
|
|
if $LeftArm/Laser/BadLaser:
|
2018-11-14 20:36:02 -05:00
|
|
|
#$LeftArm/Laser/BadLaser.health -= delta*30
|
2018-11-13 20:53:07 -05:00
|
|
|
if $LeftArm/Laser/BadLaser.health <= 100:
|
|
|
|
$LeftArm/Laser/BadLaser.fire_speed = 150
|
2018-11-14 20:36:02 -05:00
|
|
|
else:
|
|
|
|
$LeftArm/Laser/BadLaser.fire_speed = 0
|
|
|
|
$LeftArm/Laser/BadLaser/AnimatedSprite.frame = 1
|
|
|
|
$LeftArm/Laser/BadLaser/Line2D.visible = false
|
2018-11-13 20:53:07 -05:00
|
|
|
|
2018-11-14 20:36:02 -05:00
|
|
|
func hit(who):
|
|
|
|
health -= who.damage/(health_multi*3.5)
|
|
|
|
print(health)
|
|
|
|
if get_tree().is_network_server():
|
|
|
|
rpc("bossHealth", health)
|
|
|
|
emit_signal("boss_health", health, starting_health)
|
2018-11-13 20:53:07 -05:00
|
|
|
|
|
|
|
func _on_LeftBadLaser_dead(money):
|
|
|
|
left_laser_alive = false
|
|
|
|
|
|
|
|
func _on_RightBadLaser_dead(money):
|
|
|
|
right_laser_alive = false
|
2018-11-14 20:36:02 -05:00
|
|
|
|
|
|
|
func _exit_tree():
|
|
|
|
$LeftArm/Laser/BadLaser.queue_free()
|
|
|
|
$RightArm/Laser/BadLaser.queue_free()
|