59 lines
1.6 KiB
GDScript
59 lines
1.6 KiB
GDScript
extends "res://Bad.gd"
|
|
|
|
signal flash
|
|
signal boss_health
|
|
|
|
var right_laser_alive = true
|
|
var left_laser_alive = true
|
|
|
|
func _ready():
|
|
speed = 0
|
|
starting_health = 3000
|
|
health = starting_health
|
|
$RightArm/Laser/BadLaser.independent = false
|
|
#$RightArm/BadLaser.health_multi = 3
|
|
$LeftArm/Laser/BadLaser.independent = false
|
|
#$LeftArm/BadLaser.health_multi = 3
|
|
$RightArm/Laser/BadLaser.fire_speed = 25
|
|
$LeftArm/Laser/BadLaser.fire_speed = 25
|
|
$RightArm/Laser/BadLaser/Rotatable.rotation_degrees = -45
|
|
pass
|
|
|
|
func _process(delta):
|
|
#$RightArm/Forearm.rotate(delta/10)
|
|
if right_laser_alive:
|
|
if $RightArm/Laser/BadLaser:
|
|
#$RightArm/Laser/BadLaser.health -= delta*30
|
|
if $RightArm/Laser/BadLaser.health <= 100:
|
|
$RightArm/Laser/BadLaser.fire_speed = 150
|
|
else:
|
|
$RightArm/Laser/BadLaser/AnimatedSprite.frame = 1
|
|
$RightArm/Laser/BadLaser.fire_speed = 0
|
|
$RightArm/Laser/BadLaser/Line2D.visible = false
|
|
|
|
if left_laser_alive:
|
|
if $LeftArm/Laser/BadLaser:
|
|
#$LeftArm/Laser/BadLaser.health -= delta*30
|
|
if $LeftArm/Laser/BadLaser.health <= 100:
|
|
$LeftArm/Laser/BadLaser.fire_speed = 150
|
|
else:
|
|
$LeftArm/Laser/BadLaser.fire_speed = 0
|
|
$LeftArm/Laser/BadLaser/AnimatedSprite.frame = 1
|
|
$LeftArm/Laser/BadLaser/Line2D.visible = false
|
|
|
|
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)
|
|
|
|
func _on_LeftBadLaser_dead(money):
|
|
left_laser_alive = false
|
|
|
|
func _on_RightBadLaser_dead(money):
|
|
right_laser_alive = false
|
|
|
|
func _exit_tree():
|
|
$LeftArm/Laser/BadLaser.queue_free()
|
|
$RightArm/Laser/BadLaser.queue_free() |