diff options
author | tpart <tpart120@proton.me> | 2024-06-29 22:08:39 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-06-29 22:08:41 +0200 |
commit | 9a76089edbae93c874b24c53a9b79f1fe10ebe2f (patch) | |
tree | 76f003962c2f1c1219c88e6ab02bf7c53a389afb /client/audio | |
parent | 424b4ef3716e74bcc54c3eefffe6ba7994d79270 (diff) | |
download | hurrycurry-9a76089edbae93c874b24c53a9b79f1fe10ebe2f.tar hurrycurry-9a76089edbae93c874b24c53a9b79f1fe10ebe2f.tar.bz2 hurrycurry-9a76089edbae93c874b24c53a9b79f1fe10ebe2f.tar.zst |
Add Sound singleton; Restructure sound system; Add button sounds to ingame menu
Diffstat (limited to 'client/audio')
-rw-r--r-- | client/audio/sound.gd | 19 | ||||
-rw-r--r-- | client/audio/sound.tscn | 16 |
2 files changed, 35 insertions, 0 deletions
diff --git a/client/audio/sound.gd b/client/audio/sound.gd new file mode 100644 index 00000000..ddb610c5 --- /dev/null +++ b/client/audio/sound.gd @@ -0,0 +1,19 @@ +extends Node + +@onready var click_sound = $UI/Click +@onready var hover_sound = $UI/Hover + +func play_click(): + click_sound.play() + +func play_hover(): + hover_sound.play() + +func play_hover_maybe(element): + if Global.focus_auto_changed: + Global.focus_auto_changed = false + return + if element is Button: + if element.is_hovered(): + return + play_hover() diff --git a/client/audio/sound.tscn b/client/audio/sound.tscn new file mode 100644 index 00000000..7c0458dc --- /dev/null +++ b/client/audio/sound.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=4 format=3 uid="uid://d3h243yic44rr"] + +[ext_resource type="Script" path="res://audio/sound.gd" id="1_b0qb1"] +[ext_resource type="AudioStream" uid="uid://cpyn511c5mtni" path="res://menu/sounds/click.ogg" id="2_mhrce"] +[ext_resource type="AudioStream" uid="uid://dtr1khfyqr56o" path="res://menu/sounds/hover.ogg" id="3_qft2s"] + +[node name="Sound" type="Node"] +script = ExtResource("1_b0qb1") + +[node name="UI" type="Node" parent="."] + +[node name="Click" type="AudioStreamPlayer" parent="UI"] +stream = ExtResource("2_mhrce") + +[node name="Hover" type="AudioStreamPlayer" parent="UI"] +stream = ExtResource("3_qft2s") |