diff --git a/app.js b/app.js index 7a5e4d9..5808f88 100644 --- a/app.js +++ b/app.js @@ -192,7 +192,10 @@ $.fn.hexxed = function(settings) { total_score += turn_score; total_score = (Math.round(total_score*100)/100) + // decrease the turn count turns_remaining--; + + // check if no turns remain if(turns_remaining > 0) { newColor(); @@ -209,23 +212,32 @@ $.fn.hexxed = function(settings) { // Add a header to denote game over gameOver.append($("

").text("Game Over!")); - // + // Show the final score from the game gameOver.append($("

").text("Final Score: " + total_score)); - gameOver.append($('


')); - + // Create the input for players to input a name for their high score var playerNameInput = $('').attr('placeholder', 'Your name'); + + // Add the input to the page with an ID for easy value access gameOver.append(playerNameInput.attr('id', 'hsName')); + // Create a submit button to send the score to the high scores array var submit = $('