diff --git a/enemies/boss/blob_big.gd b/enemies/boss/blob_big.gd index 78f9c11..5362ea0 100644 --- a/enemies/boss/blob_big.gd +++ b/enemies/boss/blob_big.gd @@ -5,7 +5,8 @@ var angular_speed = TAU/8 var lifetime = 5 var ready_blobs = 0 -var num_blobs = 4 + +var num_blobs = 0 var particles_ended = false @@ -13,16 +14,20 @@ func _on_target_reached(): ready_blobs += 1 func _ready() -> void: + # Count those children that have a "target reached" signal and connect them. for child in get_children(): if "target_reached" in child: + num_blobs += 1 child.connect("target_reached", _on_target_reached) $SplashSound.play() func _process(delta: float) -> void: + # Once all child blobs have reached their target, start moving as one while slowly rotating. if ready_blobs == num_blobs: position += (player.position - position).normalized() * speed * delta rotate(angular_speed * delta) lifetime -= delta + # In the end, clear all child blobs, then the rest. if lifetime < 0 and not particles_ended: particles_ended = true for child in get_children():