summaryrefslogtreecommitdiff
path: root/levelSelect.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2024-07-06 12:09:59 -0500
committersanine <sanine.not@pm.me>2024-07-06 12:09:59 -0500
commit2a2dadfb9739874044bdcc20cf6152115a04bc07 (patch)
tree38fd82a28d6cdf979f2b5e613a39e3f0fbb15341 /levelSelect.js
parent2f300a221b850ae66a785523436511c06b318a22 (diff)
add button sfx
Diffstat (limited to 'levelSelect.js')
-rw-r--r--levelSelect.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/levelSelect.js b/levelSelect.js
index 6c0d995..b1f6073 100644
--- a/levelSelect.js
+++ b/levelSelect.js
@@ -6,6 +6,11 @@ const levels = {
};
export function setupLevelSelectUi(root, audio) {
+ const buttonEnterAudio = document.getElementById('sfx-buttonenter');
+ const buttonClickAudio = document.getElementById('sfx-buttonclick');
+ audio.createMediaElementSource(buttonEnterAudio).connect(audio.destination);
+ audio.createMediaElementSource(buttonClickAudio).connect(audio.destination);
+
const levelList = document.createElement('ol');
const levelPicker = name => {
const [ dependencies, level ] = levels[name];
@@ -13,7 +18,14 @@ export function setupLevelSelectUi(root, audio) {
if (allDependenciesSatisfied) {
const button = document.createElement('input');
button.type = 'button';
+ button.value = name;
+ button.onmouseenter = () => {
+ buttonEnterAudio.load();
+ buttonEnterAudio.play();
+ }
button.onclick = () => {
+ buttonClickAudio.load();
+ buttonClickAudio.play();
root.innerText = '';
setupLevelUi(level, root, audio);
}