2023-11-19 17:08:26 +02:00
|
|
|
extends AudioStreamPlayer
|
|
|
|
|
2024-03-17 01:14:31 +02:00
|
|
|
const click_sound = preload ("res://assets/sound/click.wav")
|
|
|
|
const spawn_sound = preload ("res://assets/sound/spawn.wav")
|
|
|
|
const open_menu = preload ("res://assets/sound/open_menu.wav")
|
|
|
|
const close_menu = preload ("res://assets/sound/close_menu.wav")
|
2023-11-19 17:08:26 +02:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
volume_db = -18
|
|
|
|
|
2024-03-17 01:14:31 +02:00
|
|
|
## Plays a given sound effect
|
2023-11-19 17:08:26 +02:00
|
|
|
func play_effect(sound):
|
|
|
|
if sound == "click":
|
|
|
|
stream = click_sound
|
2023-11-20 00:58:26 +02:00
|
|
|
volume_db = -18
|
2023-11-19 17:08:26 +02:00
|
|
|
elif sound == "spawn":
|
|
|
|
stream = spawn_sound
|
2023-11-20 00:58:26 +02:00
|
|
|
volume_db = -10
|
|
|
|
elif sound == "open_menu":
|
|
|
|
stream = open_menu
|
|
|
|
volume_db = -6
|
|
|
|
elif sound == "close_menu":
|
|
|
|
stream = close_menu
|
|
|
|
volume_db = -6
|
2023-11-19 17:08:26 +02:00
|
|
|
|
|
|
|
play()
|