2018-06-03 11:11:27 -04:00
|
|
|
extends "res://Bad.gd"
|
|
|
|
|
|
|
|
# class member variables go here, for example:
|
|
|
|
# var a = 2
|
|
|
|
# var b = "textvar"
|
|
|
|
|
|
|
|
var rot_speed = 1
|
|
|
|
|
2018-06-05 16:31:55 -04:00
|
|
|
signal flash
|
|
|
|
|
2018-06-03 11:11:27 -04:00
|
|
|
func _ready():
|
2018-06-05 16:31:55 -04:00
|
|
|
starting_health = 20000
|
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
|
|
|
|
|
|
|
var splitting = false
|
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
rotation += delta*rot_speed
|
|
|
|
if rotation > 2*PI:
|
|
|
|
rotation = 0
|
|
|
|
|
|
|
|
if health < starting_health*0.88:
|
|
|
|
$MainSprite.frame = 1
|
|
|
|
if health < starting_health*0.76:
|
|
|
|
$MainSprite.frame = 2
|
|
|
|
if health < starting_health*0.64:
|
|
|
|
$MainSprite.frame = 3
|
|
|
|
if health < starting_health*0.52:
|
|
|
|
$MainSprite.frame = 4
|
|
|
|
if health < starting_health*0.40:
|
|
|
|
$MainSprite.frame = 5
|
|
|
|
if health < starting_health*0.28:
|
|
|
|
$MainSprite.frame = 6
|
|
|
|
if health < starting_health*0.16:
|
|
|
|
$CollisionBox.disabled = true
|
|
|
|
$TopHalf.visible = true
|
|
|
|
$BotHalf.visible = true
|
|
|
|
$MainSprite.visible = false
|
|
|
|
if rotation_degrees > 45 && rotation_degrees < 70:
|
|
|
|
splitting = true
|
|
|
|
|
|
|
|
if splitting:
|
|
|
|
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
|