Skip to content

Commit

Permalink
Added sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
rohangoel96 committed Feb 7, 2016
1 parent f159186 commit 9c565bd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ _For people who enjoy playing word puzzles but are too lazy to move their hands

Also, the clients need to play the game in **Google Chrome Browser**. We do not support any other browsers at the moment.

The Game is best viewed on full screen. (Press F11 for toggling full screen)

##Installation

```bash
Expand Down
9 changes: 7 additions & 2 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ var spokenWords = [];
var score1=0, score2=0;
var TIME = 100;
var gameOver;
var audioGameOver = new Audio('../resources/game-over.wav');
var audioPlayer1Scores = new Audio('../resources/player1-scores.wav');
var audioPlayer2Scores = new Audio('../resources/player2-scores.wav');

function setPuzzleRows(puzzleArray) {
PUZZLE_ROWS = puzzleArray;
Expand Down Expand Up @@ -41,8 +44,8 @@ function searchWord(word, highlightColor) {
if(rowSearch(word, highlightColor) || columnSearch(word, highlightColor)) {
spokenWords.push(word);
switch(playerNo){
case '1':scoreUpdate(++score1,score2); break;
case '2':scoreUpdate(score1,++score2);break;
case '1':scoreUpdate(++score1,score2); audioPlayer1Scores.play(); break;
case '2':scoreUpdate(score1,++score2); audioPlayer2Scores.play(); break;
}

$('#logs').append(newLogButton.addClass(highlightColor));
Expand Down Expand Up @@ -96,6 +99,8 @@ function setCurrentPlayer(player){
function declareWinner(){
gameOver = true;

audioGameOver.play();

var text1 = 'GREEN'
var text2 = 'WINS!';
var winnerClass = "highlight-2";
Expand Down
Binary file added resources/game-over.wav
Binary file not shown.
Binary file added resources/player1-scores.wav
Binary file not shown.
Binary file added resources/player2-scores.wav
Binary file not shown.

0 comments on commit 9c565bd

Please sign in to comment.