(currentLevel)
| 64 | } |
| 65 | |
| 66 | function checkAnswer(currentLevel) { |
| 67 | |
| 68 | if (gamePattern[currentLevel] === userClickedPattern[currentLevel]) { |
| 69 | |
| 70 | if (userClickedPattern.length === gamePattern.length){ |
| 71 | setTimeout(function () { |
| 72 | nextSequence(); |
| 73 | }, 1000); |
| 74 | } |
| 75 | } else { |
| 76 | playSound("wrong"); |
| 77 | body.classList.add("game-over"); |
| 78 | setTimeout(function () { |
| 79 | body.classList.remove("game-over"); |
| 80 | }, 200); |
| 81 | |
| 82 | leveltitle.innerText="Game Over, Press Any Key to Restart"; |
| 83 | startOver(); |
| 84 | } |
| 85 | |
| 86 | } |
| 87 | |
| 88 | function startOver() { |
| 89 | level = 0; |
no test coverage detected