Skip to content

Commit

Permalink
New sound effects
Browse files Browse the repository at this point in the history
  • Loading branch information
ZonianMidian committed Nov 1, 2024
1 parent 6c2cefe commit 8bcf3ef
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/utils/soundEffects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ const sounds = {
failature: 'sounds/failature.mp3',
revealed: 'sounds/revealed.mp3',
success: 'sounds/success.mp3',
restart: 'sounds/restart.mp3',
start: 'sounds/start.mp3',
lose: 'sounds/lose.mp3',
win: 'sounds/win.mp3'
win: 'sounds/win.mp3',
end: 'sounds/end.mp3'
};

export const effectSounds = createAudioStore(sounds);
6 changes: 6 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
isStopEnabled = true;
isStartEnabled = false;
effectSounds.play('start', { volume: effectsVolume });
if (mode === 'Timer') {
const selectElement = document.getElementById('time') as HTMLSelectElement;
timeLimit = +selectElement?.value || 0;
Expand Down Expand Up @@ -157,6 +159,8 @@
effectSounds.play('win', { volume: effectsVolume });
} else if (mode === 'Timer') {
effectSounds.play('lose', { volume: effectsVolume });
} else {
setTimeout(() => effectSounds.play('end', { volume: effectsVolume }), 100);
}
}
}
Expand All @@ -179,6 +183,8 @@
percentages = {};
actualTime = 0;
effectSounds.play('restart', { volume: effectsVolume });
if (gameStarted) {
endGame();
clearAllInputs();
Expand Down
Binary file added static/sounds/end.mp3
Binary file not shown.
Binary file added static/sounds/restart.mp3
Binary file not shown.
Binary file added static/sounds/start.mp3
Binary file not shown.

0 comments on commit 8bcf3ef

Please sign in to comment.