From 5bf94ebb0ea98c20a18cb1dde4a52ee4b008825e Mon Sep 17 00:00:00 2001 From: Gamaliel Padillo Date: Tue, 2 Feb 2016 21:35:29 -0800 Subject: [PATCH] Merge Attempt 2 --- js/script.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/js/script.js b/js/script.js index e34221f..b524d52 100644 --- a/js/script.js +++ b/js/script.js @@ -147,29 +147,19 @@ $(document).ready(function() { die.pause(); die.play(); } -<<<<<<< HEAD - - storage = localStorage.setItem('topScore', highscore); - $(".currentScore").text("Your score: " + score); - $("#highScore").text(localStorage.topScore); - if(score > localStorage.getItem('topScore')){ - highscore ++; - } -======= var storedHighscore = 0; - localStorage.setItem("highscore", highscore); - $(".currentScore").text("Your score: " + score); - if(score > highscore) { - highscore ++; - if (score > storedHighscore && localStorage.highscore !== undefined) { - localStorage.highscore = storedHighscore; - } else if(score > storedHighscore && localStorage.highscore === undefined){ - storedHighscore++; - localStorage.highscore = storedHighscore; - } - } - $("#highScore").text(highscore); ->>>>>>> master + localStorage.setItem("highscore", highscore); + $(".currentScore").text("Your score: " + score); + if(score > highscore) { + highscore ++; + if (score > storedHighscore && localStorage.highscore !== undefined) { + localStorage.highscore = storedHighscore; + } else if(score > storedHighscore && localStorage.highscore === undefined){ + storedHighscore++; + localStorage.highscore = storedHighscore; + } + } + $("#highScore").text(highscore); if(newX === food.x && newY === food.y){ tail = {x: newX, y: newY};