1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 23:34:18 +00:00

Add debug logging to Collectible and UniversalCollector

This commit is contained in:
Steffo 2023-10-03 02:13:20 +02:00
parent f7c0b2359a
commit d1429d4b3c
Signed by: steffo
GPG key ID: 2A24051445686895
2 changed files with 3 additions and 0 deletions

View file

@ -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. ## 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(): func collect():
print("[Collectible] Collected ", self, "!")
collected.emit() collected.emit()
func _on_done(): func _on_done():
print("[Collectible] Deleting ", self, "...")
get_parent().queue_free() get_parent().queue_free()

View file

@ -20,6 +20,7 @@ signal goal
func _on_body_entered(body: Node2D): func _on_body_entered(body: Node2D):
if body is PhysicsBody2D: if body is PhysicsBody2D:
print("[UniversalCollector] Body entered: ", body)
var collectible: Collectible = body.find_child("Collectible") var collectible: Collectible = body.find_child("Collectible")
if collectible: if collectible:
collected_count += 1 collected_count += 1