Add new level, collapsable component, knockback component

This commit is contained in:
2024-12-31 02:51:07 +01:00
parent 529dc0f5dc
commit 366c269817
17 changed files with 647 additions and 31 deletions

View File

@@ -9,14 +9,14 @@ var root: Node
signal collected(amount: int)
func _ready() -> void:
if area2d:
area2d.body_entered.connect(_on_area2d_body_entered)
else:
print("Collectable node missing Area2D child.")
if area2d:
area2d.body_entered.connect(_on_area2d_body_entered)
else:
print("Collectable node missing Area2D child.")
root = get_parent()
root = get_parent()
func _on_area2d_body_entered(body: Node2D) -> void:
if body.has_node("CanPickUpComponent"):
collected.emit(collectable_data.amount)
root.queue_free()
if body.has_node("CanPickUpComponent"):
collected.emit(collectable_data.amount)
root.queue_free()