Skip to content

Instantly share code, notes, and snippets.

@nklsrh
Created July 10, 2013 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nklsrh/5963066 to your computer and use it in GitHub Desktop.
Save nklsrh/5963066 to your computer and use it in GitHub Desktop.
// checks if either player or opponent has reached 7 points
function matchScoreCheck()
{
// if player has 7 points
if (score1 >= maxScore)
{
// stop the ball
ballSpeed = 0;
// write to the banner
document.getElementById("scores").innerHTML = "Player wins!";
document.getElementById("winnerBoard").innerHTML = "Refresh to play again";
}
// else if opponent has 7 points
else if (score2 >= maxScore)
{
// stop the ball
ballSpeed = 0;
// write to the banner
document.getElementById("scores").innerHTML = "CPU wins!";
document.getElementById("winnerBoard").innerHTML = "Refresh to play again";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment