made scoring functional

This commit is contained in:
Garrett Finucane 2015-06-01 19:15:32 -04:00
parent b3852f421d
commit bfe2b35650
3 changed files with 10 additions and 9 deletions

View file

@ -217,10 +217,9 @@
<div id = 'gameOverBox' class = 'GOTitle'>GAME OVER</div>
<div id = 'cScore'>1843</div>
<div id = 'highScoresTitle' class = 'GOTitle'>HIGH SCORES</div>
<div class = 'score'><span class = 'scoreNum'>1.</span> 1870</div>
<div class = 'score'><span class = 'scoreNum'>2.</span> 1540</div>
<div class = 'score'><span class = 'scoreNum'>3.</span> 1130</div>
<div class = 'score'><span class = 'scoreNum'>4.</span> 960</div>
<div class = 'score'><span class = 'scoreNum'>1.</span> <div id="1place" style="display:inline;">0</div></div>
<div class = 'score'><span class = 'scoreNum'>2.</span> <div id="2place" style="display:inline;">0</div></div>
<div class = 'score'><span class = 'scoreNum'>3.</span> <div id="3place" style="display:inline;">0</div></div>
</div>
<div id = 'bottomContainer'>
<img id='restart' src = './images/btn_restart.svg' height = '57px'>

View file

@ -166,11 +166,6 @@ function handleClickTap(x,y) {
Vertexes = Vertexes.map(function(coord){
return [coord[0] + trueCanvas.width/2, coord[1] + trueCanvas.height/2]});
if (gameState == 1 && inside([x,y],Vertexes)){
toggleRush();
return;
}
if (!MainHex || gameState === 0 || gameState==-1) {
return;
}

View file

@ -179,6 +179,7 @@ function gameOverDisplay() {
$("#attributions").show();
var c = document.getElementById("canvas");
c.className = "blur";
updateHighScores();
$("#gameoverscreen").fadeIn();
$("#buttonCont").fadeIn();
$("#container").fadeIn();
@ -186,6 +187,12 @@ function gameOverDisplay() {
$("#restart").fadeIn();
}
function updateHighScores (){
$("#cScore").text(score);
$("#1score").text(highscores[0]);
$("#2score").text(highscores[1]);
$("#3score").text(highscores[2]);
}
function pause(o) {
writeHighScores();
var message;