2018-06-03 11:11:27 -04:00
|
|
|
extends "res://Bad.gd"
|
|
|
|
|
|
|
|
var rot_speed = 1
|
2018-11-12 23:17:53 -05:00
|
|
|
var dying = false
|
|
|
|
var splitting = false
|
2018-06-03 11:11:27 -04:00
|
|
|
|
2018-06-05 16:31:55 -04:00
|
|
|
signal flash
|
|
|
|
|
2018-06-03 11:11:27 -04:00
|
|
|
func _ready():
|
2018-11-12 23:17:53 -05:00
|
|
|
starting_health = 5000
|
2018-06-03 11:11:27 -04:00
|
|
|
health = starting_health
|
|
|
|
speed = 10
|
2018-06-05 16:31:55 -04:00
|
|
|
kill_reward = 1000
|
|
|
|
boss = true
|
2018-06-03 11:11:27 -04:00
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
rotation += delta*rot_speed
|
|
|
|
if rotation > 2*PI:
|
|
|
|
rotation = 0
|
|
|
|
|
2018-11-12 23:17:53 -05:00
|
|
|
if dying == true:
|
2018-06-03 11:11:27 -04:00
|
|
|
$TopHalf.visible = true
|
|
|
|
$BotHalf.visible = true
|
|
|
|
$MainSprite.visible = false
|
|
|
|
if rotation_degrees > 45 && rotation_degrees < 70:
|
2018-11-12 23:17:53 -05:00
|
|
|
if rot_speed != 0:
|
|
|
|
emit_signal("flash")
|
2018-06-03 11:11:27 -04:00
|
|
|
splitting = true
|
2018-11-12 23:17:53 -05:00
|
|
|
health = 999999
|
|
|
|
elif health < starting_health*0.16:
|
|
|
|
dying = true
|
|
|
|
#$CollisionBox.disabled = true
|
|
|
|
elif health < starting_health*0.28:
|
|
|
|
if $MainSprite.frame != 6:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 6
|
|
|
|
elif health < starting_health*0.40:
|
|
|
|
if $MainSprite.frame != 5:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 5
|
|
|
|
elif health < starting_health*0.52:
|
|
|
|
if $MainSprite.frame != 4:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 4
|
|
|
|
elif health < starting_health*0.64:
|
|
|
|
if $MainSprite.frame != 3:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 3
|
|
|
|
elif health < starting_health*0.76:
|
|
|
|
if $MainSprite.frame != 2:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 2
|
|
|
|
elif health < starting_health*0.88:
|
|
|
|
if $MainSprite.frame != 1:
|
|
|
|
emit_signal("flash")
|
|
|
|
$MainSprite.frame = 1
|
2018-06-03 11:11:27 -04:00
|
|
|
|
|
|
|
if splitting:
|
2018-11-12 23:17:53 -05:00
|
|
|
$CollisionBox.disabled = true
|
2018-06-03 11:11:27 -04:00
|
|
|
rot_speed = 0
|
|
|
|
$TopHalf.position.y -= delta*500
|
|
|
|
$TopHalf.position.x -= delta*250
|
|
|
|
$BotHalf.position.y += delta*500
|
|
|
|
$BotHalf.position.x += delta*250
|
|
|
|
|
2018-06-05 16:31:55 -04:00
|
|
|
if $TopHalf.position.y < -2000:
|
|
|
|
$Music.volume_db -= delta*50
|
|
|
|
|
|
|
|
if $TopHalf.position.y < -4000:
|
|
|
|
emit_signal("dead", kill_reward)
|
|
|
|
queue_free()
|
|
|
|
|
2018-06-03 11:11:27 -04:00
|
|
|
$TopHalf.rotation += delta
|
|
|
|
$BotHalf.rotation -= delta
|