Add terrain hit effects, progressive damage component, and update collectable signals

This commit is contained in:
2025-05-29 01:00:19 +02:00
parent 37b96c0f11
commit 26af7a591d
29 changed files with 406 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ var has_fade_away: bool = false
@export var collision_shape: CollisionShape2D
@export var collectable_data: CollectableResource
@export var sfx: AudioStreamPlayer2D
signal collected(amount: int, type: CollectableResource.CollectableType)
signal collected(amount: Variant, type: CollectableResource.CollectableType, body: Node2D)
func _ready() -> void:
@@ -25,11 +25,12 @@ func _ready() -> void:
func _on_area2d_body_entered(body: Node2D) -> void:
if body.has_node("CanPickUpComponent"):
collected.emit(collectable_data.amount, collectable_data.type)
collected.emit(collectable_data.amount, collectable_data.type, body)
if collision_shape:
collision_shape.call_deferred("set_disabled", true)
if sfx:
sfx.play()
if not has_fade_away:
if sfx:
await sfx.finished
root.queue_free()