From f4b7b80c2263657857e1554f9c4e2f987e716316 Mon Sep 17 00:00:00 2001 From: lengstrom Date: Fri, 25 Jul 2014 23:10:23 -0400 Subject: [PATCH] made pause button switch states based on the actual gameState value rather than handlers --- js/initialization.js | 1 + js/input.js | 1 + js/view.js | 14 ++------------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/js/initialization.js b/js/initialization.js index 8590821..fd564a6 100644 --- a/js/initialization.js +++ b/js/initialization.js @@ -123,6 +123,7 @@ function initialize(a) { window.numHighScores = 3; window.highscores = []; + debugger; if(localStorage.getItem('highscores')) highscores = JSON.parse(localStorage.getItem('highscores')); diff --git a/js/input.js b/js/input.js index 36ccc3b..3ca5f59 100644 --- a/js/input.js +++ b/js/input.js @@ -59,6 +59,7 @@ function addKeyListeners() { } } }); + $("#pauseBtn").on('touchstart mousedown', function() { if (gameState != 1 && gameState != -1) { return; diff --git a/js/view.js b/js/view.js index f6eecbc..1bbb876 100644 --- a/js/view.js +++ b/js/view.js @@ -161,17 +161,6 @@ function gameOverDisplay(){ showbottombar(); } -function togglePlayIcon (){ - if ($($("#pauseBtn").children()[0]).attr('class').indexOf('pause') == -1) { - $("#pauseBtn").html(''); - } else { - $("#pauseBtn").html(''); - } - - return false; -} - - function pause(o) { localStorage.setItem('highscores', JSON.stringify(highscores)); var message; @@ -184,6 +173,7 @@ function pause(o) { var c = document.getElementById("canvas"); if (gameState == -1) { + $("#pauseBtn").html(''); if ($('#helpScreen').is(':visible')) { $('#helpScreen').fadeOut(150, "linear"); } @@ -202,7 +192,7 @@ function pause(o) { if (message == 'paused') { showText(message); } - + $("#pauseBtn").html(''); prevGameState = gameState; gameState = -1; }