add click sound as SFX
This commit is contained in:
BIN
audio/817587__silverdubloons__tick06.wav
Normal file
BIN
audio/817587__silverdubloons__tick06.wav
Normal file
Binary file not shown.
24
audio/817587__silverdubloons__tick06.wav.import
Normal file
24
audio/817587__silverdubloons__tick06.wav.import
Normal file
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://briuh6uhf0tdt"
|
||||
path="res://.godot/imported/817587__silverdubloons__tick06.wav-6928d7a957ad4e7ff0ddda00a7348675.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/817587__silverdubloons__tick06.wav"
|
||||
dest_files=["res://.godot/imported/817587__silverdubloons__tick06.wav-6928d7a957ad4e7ff0ddda00a7348675.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
@@ -1,13 +1,19 @@
|
||||
extends Node
|
||||
|
||||
const MUSIC_PATH := "res://audio/Space Horror InGame Music (Exploration) _Clement Panchout.wav"
|
||||
const UI_CLICK_SOUND_PATH := "res://audio/817587__silverdubloons__tick06.wav"
|
||||
|
||||
var music_player: AudioStreamPlayer
|
||||
var ui_click_player: AudioStreamPlayer
|
||||
|
||||
func _ready():
|
||||
music_player = AudioStreamPlayer.new()
|
||||
add_child(music_player)
|
||||
|
||||
ui_click_player = AudioStreamPlayer.new()
|
||||
ui_click_player.bus = "SFX"
|
||||
add_child(ui_click_player)
|
||||
|
||||
var orig_stream = _load_stream()
|
||||
if not orig_stream:
|
||||
push_error("Failed to load music stream: %s" % MUSIC_PATH)
|
||||
@@ -59,3 +65,9 @@ func _stop_music() -> void:
|
||||
if not music_player.playing:
|
||||
return
|
||||
music_player.stop()
|
||||
|
||||
func play_ui_click() -> void:
|
||||
var click_stream = load(UI_CLICK_SOUND_PATH)
|
||||
if click_stream and click_stream is AudioStream:
|
||||
ui_click_player.stream = click_stream
|
||||
ui_click_player.play()
|
||||
|
||||
@@ -6,12 +6,15 @@ func _ready():
|
||||
print("MainMenu ready")
|
||||
|
||||
func _on_new_game_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("New Game pressed")
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Settings pressed")
|
||||
open_settings.emit()
|
||||
|
||||
func _on_exit_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Exit pressed")
|
||||
get_tree().quit()
|
||||
|
||||
@@ -60,6 +60,7 @@ func _input(event):
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _on_back_button_pressed():
|
||||
AudioManager.play_ui_click()
|
||||
print("Back button pressed")
|
||||
_exit_settings()
|
||||
|
||||
@@ -96,6 +97,7 @@ func update_text():
|
||||
|
||||
|
||||
func _on_reset_setting_button_pressed() -> void:
|
||||
AudioManager.play_ui_click()
|
||||
print("Resetting settings")
|
||||
settings_manager.reset_settings_to_defaults()
|
||||
_update_controls_from_settings()
|
||||
|
||||
Reference in New Issue
Block a user