From b00c0099d80c1db2eb5a7163cc29fe8ff7da4281 Mon Sep 17 00:00:00 2001 From: Garrett Finucane Date: Thu, 27 Aug 2015 19:12:05 -0400 Subject: [PATCH] instructions text fixed tap -> arrow keys on desktop --- index.html | 2 +- js_v9/render.js | 19 +++++++++++++------ js_v9/view.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index da413a2..71a6021 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ -
+
diff --git a/js_v9/render.js b/js_v9/render.js index 4e35c9f..61da5f1 100644 --- a/js_v9/render.js +++ b/js_v9/render.js @@ -71,12 +71,19 @@ function render() { } function renderBeginningText() { - renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 135 * settings.scale, 20, '#2c3e50', 'Tap on the left or the right of the screen', '20px Exo'); - renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 105 * settings.scale, 20, '#2c3e50', 'to rotate the hexagon.', '20px Exo'); - drawKey("",(trueCanvas.width)/2 + 1.5 * settings.scale - 5 , (trueCanvas.height)/3 - 35 - 107 * settings.scale); - renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height * 3.1)/3 - 35 - 135 * settings.scale, 20, '#2c3e50', 'Match 3+ blocks to score points.', '20px Exo'); - renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height * 3.1 )/3 - 35 - 105 * settings.scale, 20, '#2c3e50', 'Tap the center to double the speed.', '20px Exo'); - + if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 135 * settings.scale, 20, '#2c3e50', 'Tap on the left or the right of the screen', '20px Exo'); + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 105 * settings.scale, 20, '#2c3e50', 'to rotate the hexagon.', '20px Exo'); + drawKey("",(trueCanvas.width)/2 + 1.5 * settings.scale - 5 , (trueCanvas.height)/3 - 35 - 107 * settings.scale); + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height * 3.1)/3 - 35 - 135 * settings.scale, 20, '#2c3e50', 'Match 3+ blocks to score points.', '20px Exo'); + } + else { + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 135 * settings.scale, 20, '#2c3e50', 'Use the right and left arrow keys', '20px Exo'); + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/3 - 35 - 105 * settings.scale, 20, '#2c3e50', 'to rotate the hexagon.', '20px Exo'); + drawKey("",(trueCanvas.width)/2 + 1.5 * settings.scale - 5 , (trueCanvas.height)/3 - 35 - 107 * settings.scale); + renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height * 3.1)/3 - 35 - 120 * settings.scale, 20, '#2c3e50', 'Match 3+ blocks to score points.', '20px Exo'); + } + //renderText((trueCanvas.width)/2 + 1.5 * settings.scale, (trueCanvas.height)/2 - 35 - 65 * settings.scale, 20, '#2c3e50', (settings.platform == 'mobile' ? 'Tap the middle to toggle 2x speed!' : 'Hold the down arrow to toggle 2x speed!'), '20px Exo'); } diff --git a/js_v9/view.js b/js_v9/view.js index 7f06bf1..2dabf72 100644 --- a/js_v9/view.js +++ b/js_v9/view.js @@ -163,6 +163,30 @@ function updateHighScores (){ $("#2place").text(highscores[1]); $("#3place").text(highscores[2]); } +function fadeFade(opacity,step,thresh,sign){ + + //if(sign){ + //if(opacity < thresh){ + //console.log("hi"); + //ctx.clearRect(0,0, trueCanvas.width,trueCanvas.height); + //ctx.globalAlpha = opacity; + //ctx.fillStyle = 'rgb(236,240,241)'; + //ctx.fillRect(0, 0, trueCanvas.width, trueCanvas.height); + //ctx.globalAlpha = 1; + //setTimeout(function(){fadeFade(opacity + step,step,thresh,sign)},1); + //} + //} + //else{ + //if(opacity > thresh){ + //ctx.globalAlpha = opacity; + //ctx.fillStyle = 'rgb(236,240,241)'; + //ctx.clearRect(0,0, trueCanvas.width,trueCanvas.height); + //ctx.fillRect(0, 0, trueCanvas.width, trueCanvas.height); + //ctx.globalAlpha = 1; + //setTimeout(function(){fadeFade(opacity + step,step,thresh,sign)},1); + //} + //} +} var pausable = true; function pause(o) { if (gameState == 0 || gameState == 2 || !pausable) { @@ -189,11 +213,13 @@ function pause(o) { $("#pauseBtn").attr("src", "./images/btn_pause.svg"); $('.helpText').fadeOut(300, 'linear'); + $('#overlay').fadeOut(300, 'linear'); hideText(); setTimeout(function() { gameState = prevGameState; pausable =true; }, 400); + setTimeout(function(){fadeFade(0.9,-0.0025,0,false)},5); } else if (gameState != -2 && gameState !== 0 && gameState !== 2) { $('#restartBtn').fadeIn(300, "linear"); $('#buttonCont').fadeIn(300, "linear"); @@ -203,10 +229,12 @@ function pause(o) { } $('#fork-ribbon').fadeIn(300, 'linear'); $("#pauseBtn").attr("src","./images/btn_resume.svg"); + $('#overlay').fadeIn(300, 'linear'); prevGameState = gameState; setTimeout(function() { pausable = true; }, 400); + setTimeout(function(){fadeFade(0,0.0025,0.9,true)},1); gameState = -1; } }