Fronter/BlackHole.gd

60 lines
1.3 KiB
GDScript3
Raw Normal View History

extends "res://Bad.gd"
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var rot_speed = 1
signal flash
func _ready():
starting_health = 20000
health = starting_health
speed = 10
kill_reward = 1000
boss = true
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
if $TopHalf.position.y < -2000:
$Music.volume_db -= delta*50
if $TopHalf.position.y < -4000:
emit_signal("dead", kill_reward)
queue_free()
$TopHalf.rotation += delta
$BotHalf.rotation -= delta