From d1429d4b3c2bb055a39f3d0825938bcd550affe2 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 3 Oct 2023 02:13:20 +0200 Subject: [PATCH] Add debug logging to `Collectible` and `UniversalCollector` --- collector/collectible.gd | 2 ++ collector/universal_collector.gd | 1 + 2 files changed, 3 insertions(+) diff --git a/collector/collectible.gd b/collector/collectible.gd index 3d1ac3f..42cc38b 100644 --- a/collector/collectible.gd +++ b/collector/collectible.gd @@ -15,8 +15,10 @@ signal collected ## ## You'll probably want to connect this to an AudioSource2D, which will disable the node and play a sound, and when the sound is over a new signal will queue_free it. func collect(): + print("[Collectible] Collected ", self, "!") collected.emit() func _on_done(): + print("[Collectible] Deleting ", self, "...") get_parent().queue_free() diff --git a/collector/universal_collector.gd b/collector/universal_collector.gd index 20677ed..9fdf358 100644 --- a/collector/universal_collector.gd +++ b/collector/universal_collector.gd @@ -20,6 +20,7 @@ signal goal func _on_body_entered(body: Node2D): if body is PhysicsBody2D: + print("[UniversalCollector] Body entered: ", body) var collectible: Collectible = body.find_child("Collectible") if collectible: collected_count += 1