Skip to content

Commit

Permalink
Fix problem with delayed score display
Browse files Browse the repository at this point in the history
  • Loading branch information
blinry committed Jun 24, 2017
1 parent c6b1531 commit 04b2b58
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -9,7 +9,7 @@
<link rel='stylesheet' href='css/bootstrap.css' />
<link rel='stylesheet' href='css/style.css' />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=AIzaSyCZOXlIZdfYBcn_W8UrY-JYrE3eueQq4_k&sensor=false&libraries=geometry'></script>
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=AIzaSyBEFop9rBOtlP5sj7fhnjr8CK9KUavKNiU&sensor=false&libraries=geometry'></script>
<script type='text/javascript' src='js/rnd.js'></script>
<script type='text/javascript' src='js/minimap.js'></script>
<script type='text/javascript' src='js/streetviewmap.js'></script>
Expand Down
51 changes: 32 additions & 19 deletions js/app.js
Expand Up @@ -49,13 +49,33 @@
$('#roundEnd').on('click', '.closeBtn', function () {
$('#roundEnd').fadeOut(500);

// Reload maps to refresh coords
svinitialize();
mminitialize();
rminitialize();
if (round < 5){

round++
if(ranOut==true){
roundScore = 0;
} else {
roundScore = points;
totalScore = totalScore + points;
}

$('.round').html('Current Round: <b>'+round+'/5</b>');
$('.roundScore').html('Last Round Score: <b>'+roundScore+'</b>');
$('.totalScore').html('Total Score: <b>'+totalScore+'</b>');

// Reset Timer
resetTimer();
var img = document.getElementById('image');
img.src = "";

// Reload maps to refresh coords
svinitialize();
mminitialize();
rminitialize();

// Reset Timer
resetTimer();
} else if (round >= 5){
endGame();
};
});

// End of game 'play again' button click
Expand Down Expand Up @@ -139,12 +159,15 @@
points = 0;
};

if (round < 5){
/*
if (round < 3){
endRound();
} else if (round >= 5){
} else if (round >= 3){
endGame();
};
*/
endRound();

} else {

Expand All @@ -158,17 +181,6 @@
};

function endRound(){
round++
if(ranOut==true){
roundScore = 0;
} else {
roundScore = points;
totalScore = totalScore + points;
}

$('.round').html('Current Round: <b>'+round+'/5</b>');
$('.roundScore').html('Last Round Score: <b>'+roundScore+'</b>');
$('.totalScore').html('Total Score: <b>'+totalScore+'</b>');

// If distance is undefined, that means they ran out of time and didn't click the guess button
if(typeof distance === 'undefined' || ranOut == true){
Expand Down Expand Up @@ -200,6 +212,7 @@
window.guessLatLng = '';
ranOut = false;


};

function endGame(){
Expand Down

0 comments on commit 04b2b58

Please sign in to comment.