From 60e32002c1a67614d39fe4f5fc32f6972515d053 Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Sat, 11 Oct 2025 19:44:05 +0200 Subject: [PATCH] Refactored and documented blob_big.gd --- enemies/boss/blob_big.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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():