From 19d458f7fddf47b2180eed30b64125c71df66fca Mon Sep 17 00:00:00 2001 From: Charles Hill Date: Wed, 5 Jul 2017 13:23:20 -0700 Subject: [PATCH] added the option to press down or s key to speed up dropping bars --- js/initialization.js | 2 ++ js/input.js | 47 +++++++++++++++++++++++++++++++++++++++++++- js/main.js | 2 +- js/view.js | 4 ++-- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/js/initialization.js b/js/initialization.js index 64d0e66..1350f02 100644 --- a/js/initialization.js +++ b/js/initialization.js @@ -64,6 +64,7 @@ function initialize(a) { blockHeight: 20, rows: 7, speedModifier: 0.73, + speedUpKeyHeld: false, creationSpeedModifier: 0.73, comboTime: 310 }; @@ -82,6 +83,7 @@ function initialize(a) { blockHeight: 15, rows: 8, speedModifier: 0.65, + speedUpKeyHeld: false, creationSpeedModifier: 0.65, comboTime: 310 }; diff --git a/js/input.js b/js/input.js index c559fb0..190f66f 100644 --- a/js/input.js +++ b/js/input.js @@ -16,6 +16,29 @@ function addKeyListeners() { } } }); + keypress.register_combo({ + keys: "down", + on_keydown: function() { + var tempSpeed = settings.speedModifier; + if (MainHex && gameState !== 0){ + //speed up block temporarily + if(settings.speedUpKeyHeld == false){ + settings.speedUpKeyHeld = true; + window.rush *=4; + } + } + //settings.speedModifier = tempSpeed; + }, + on_keyup:function(){ + if (MainHex && gameState !== 0){ + //speed up block temporarily + + window.rush /=4; + settings.speedUpKeyHeld = false; + } + } + }); + keypress.register_combo({ keys: "a", on_keydown: function() { @@ -33,7 +56,29 @@ function addKeyListeners() { } } }); - + + keypress.register_combo({ + keys: "s", + on_keydown: function() { + var tempSpeed = settings.speedModifier; + if (MainHex && gameState !== 0){ + //speed up block temporarily + if(settings.speedUpKeyHeld == false){ + settings.speedUpKeyHeld = true; + window.rush *=4; + } + } + //settings.speedModifier = tempSpeed; + }, + on_keyup:function(){ + if (MainHex && gameState !== 0){ + //speed up block temporarily + + window.rush /=4; + settings.speedUpKeyHeld = false; + } + } + }); keypress.register_combo({ keys: "p", on_keydown: function(){pause();} diff --git a/js/main.js b/js/main.js index afc8515..7092c15 100644 --- a/js/main.js +++ b/js/main.js @@ -360,7 +360,7 @@ function showHelp() { } } - $("#inst_main_body").html("
HOW TO PLAY

The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.

" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'Tap the left and right sides of the screen') + " to rotate the Hexagon

Clear blocks and get points by making 3 or more blocks of the same color touch.

Time left before your combo streak disappears is indicated by the colored lines on the outer hexagon


By Logan Engstrom & Garrett Finucane
Find Hextris on iOS & Android
More @ the Hextris Website"); + $("#inst_main_body").html("
HOW TO PLAY

The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.

" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'Tap the left and right sides of the screen') + " to rotate the Hexagon." + (settings.platform != 'mobile' ? ' Press the down arrow to speed up the block falling': '') + "

Clear blocks and get points by making 3 or more blocks of the same color touch.

Time left before your combo streak disappears is indicated by the colored lines on the outer hexagon


By Logan Engstrom & Garrett Finucane
Find Hextris on iOS & Android
More @ the Hextris Website"); if (gameState == 1) { pause(); } diff --git a/js/view.js b/js/view.js index aeecc81..98b442b 100644 --- a/js/view.js +++ b/js/view.js @@ -34,9 +34,9 @@ function drawScoreboard() { } else if (scoreString.length == 9) { scoreSize = 27; } - if (rush ==1){ + //if (rush ==1){ var color = "rgb(236, 240, 241)"; - } + //} var fontSize = settings.platform == 'mobile' ? 35 : 30; var h = trueCanvas.height / 2 + gdy + 100 * settings.scale; if (gameState === 0) {