class_name HiveMind extends Entity @onready var wave_1 = [$Viruling, $Viruling2, $Viruling3] @onready var wave_2 = [$Viruling4, $Viruling5, $Crawler] @onready var wave_3 = [$Viruling6, $Viruling7, $Viruling8, $Crawler2] @onready var hurtbox = $CollisionShape2D @onready var spawn_sfx = $SpawnMinionsSFX @onready var boss_hurt_sfx = $BossHurtSFX @onready var boss_death_sfx = $BossDeathSFX @onready var hurt_timer = $HurtTimer @onready var death_timer = $DeathTimer @onready var sprite = $AnimatedSprite2D @onready var intro_timer = $IntroAnimTimer var complete = false var wave_2_start = false var wave_3_start = false var shields_down = false var hurting = false var is_dying = false var is_intro_anim = true func _init() -> void: super._init(100, 0, 0) func _ready(): intro_timer.start() hurtbox.disabled = true if !spawn_sfx.playing: spawn_sfx.play for enemy in wave_1: if enemy.has_method("charge"): enemy.call("charge") func _process(delta: float) -> void: # ----- Make sure no damage taken before shields down ------ if !shields_down: health = 100 # ---------------------------------------------------------- # --- Wave death counters ------- for enemy in wave_1: if enemy.is_dying: wave_1.erase(enemy) for enemy in wave_2: if enemy.is_dying: wave_2.erase(enemy) for enemy in wave_3: if enemy.is_dying: wave_3.erase(enemy) # ------------------------------- # ------- Wave start calls ------------------ if wave_1 == [] and !wave_2_start: if !spawn_sfx.playing: spawn_sfx.play() wave_2_start = true for enemy in wave_2: enemy.charge() hurt_timer.start() if wave_1 == [] and wave_2 == [] and !wave_3_start: if !spawn_sfx.playing: spawn_sfx.play() wave_3_start = true for enemy in wave_3: enemy.charge() hurt_timer.start() if wave_1 == [] and wave_2 == [] and wave_3 == []: shields_down = true hurtbox.disabled = false if death_timer.is_stopped() and !is_dying: death_timer.start() is_dying = true complete = true # ----------------------------------------- # ------- Anims ---------- if is_intro_anim and !intro_timer.is_stopped(): sprite.play("intro") elif is_intro_anim and intro_timer.is_stopped(): is_intro_anim = false elif !is_dying: if hurt_timer.is_stopped(): sprite.play("blinkleft") else: sprite.play("ow") else: sprite.play("death") if death_timer.is_stopped(): queue_free() else: if !boss_death_sfx.playing: boss_death_sfx.play() # ---------------------------------------- # The hive mind is static. Don't worry abt this. func _physics_process(delta: float) -> void: pass func hurt_anim() -> void: if shields_down and !hurting: hurting = true hurt_timer.start() func is_complete() -> bool: return complete