Add sound effects for player actions and collectables
This commit is contained in:
@@ -6,6 +6,7 @@ var has_fade_away: bool = false
|
||||
|
||||
@export var area2d: Area2D
|
||||
@export var collectable_data: CollectableResource
|
||||
@export var sfx: AudioStreamPlayer2D
|
||||
signal collected(amount: int)
|
||||
|
||||
|
||||
@@ -24,5 +25,8 @@ func _ready() -> void:
|
||||
func _on_area2d_body_entered(body: Node2D) -> void:
|
||||
if body.has_node("CanPickUpComponent"):
|
||||
collected.emit(collectable_data.amount)
|
||||
if sfx:
|
||||
sfx.play()
|
||||
if not has_fade_away:
|
||||
await sfx.finished
|
||||
root.queue_free()
|
||||
|
Reference in New Issue
Block a user