Skip to content

Commit

Permalink
dumb sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ZintisMay committed May 24, 2024
1 parent a6cb821 commit e54064b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Binary file added audio/anime-wow-sound-effect.mp3
Binary file not shown.
Binary file added audio/duck-toy-sound.mp3
Binary file not shown.
Binary file added audio/punch_u4LmMsr.mp3
Binary file not shown.
13 changes: 12 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const resetGameButton = document.getElementById("resetGameButton");
gameSizeInput.value = gameSize;
gameDifficultyInput.value = gameDifficulty;

const SOUNDS = {
animeWow: new Audio("./audio/anime-wow-sound-effect.mp3"),
duckToy: new Audio("./audio/duck-toy-sound.mp3"),
punch: new Audio("./audio/punch_u4LmMsr.mp3"),
};

const DIRECTIONS = {
n: [0, -1],
s: [0, 1],
Expand Down Expand Up @@ -126,10 +132,15 @@ gameArea.addEventListener("click", function (e) {
if (!currentAction) alert("Please pick an action");
let coord = e.target.dataset.coord;
GAME_ACTIONS[currentAction](coord);
SOUNDS.duckToy.play();
actionCount[currentAction]--;
incrementMoves();
saveGameStartState();
if (isVictorious()) setTimeout(() => alert("you win!"), 10);
if (isVictorious())
setTimeout(() => {
alert("you win!");
SOUNDS.animeWow.play();
}, 10);
if (actionCount[currentAction] <= 0) {
currentAction = null;
}
Expand Down

0 comments on commit e54064b

Please sign in to comment.