added the option to press down or s key to speed up dropping bars

This commit is contained in:
Charles Hill 2017-07-05 13:23:20 -07:00
parent e879e0e2ee
commit 19d458f7fd
4 changed files with 51 additions and 4 deletions

View file

@ -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
};

View file

@ -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() {
@ -34,6 +57,28 @@ 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();}

View file

@ -360,7 +360,7 @@ function showHelp() {
}
}
$("#inst_main_body").html("<div id = 'instructions_head'>HOW TO PLAY</div><p>The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.</p><p>" + (settings.platform != 'mobile' ? 'Press the right and left arrow keys' : 'Tap the left and right sides of the screen') + " to rotate the Hexagon</p><p>Clear blocks and get points by making 3 or more blocks of the same color touch.</p><p>Time left before your combo streak disappears is indicated by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>on</span> the outer hexagon</p> <hr> <p id = 'afterhr'></p> By <a href='http://loganengstrom.com' target='_blank'>Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target='_blank'>Garrett Finucane</a><br>Find Hextris on <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8' target='_blank'>iOS</a> & <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris' target='_blank'>Android</a><br>More @ the <a href ='http://hextris.github.io/' target='_blank'>Hextris Website</a>");
$("#inst_main_body").html("<div id = 'instructions_head'>HOW TO PLAY</div><p>The goal of Hextris is to stop blocks from leaving the inside of the outer gray hexagon.</p><p>" + (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': '') + " </p><p>Clear blocks and get points by making 3 or more blocks of the same color touch.</p><p>Time left before your combo streak disappears is indicated by <span style='color:#f1c40f;'>the</span> <span style='color:#e74c3c'>colored</span> <span style='color:#3498db'>lines</span> <span style='color:#2ecc71'>on</span> the outer hexagon</p> <hr> <p id = 'afterhr'></p> By <a href='http://loganengstrom.com' target='_blank'>Logan Engstrom</a> & <a href='http://github.com/garrettdreyfus' target='_blank'>Garrett Finucane</a><br>Find Hextris on <a href = 'https://itunes.apple.com/us/app/id903769553?mt=8' target='_blank'>iOS</a> & <a href ='https://play.google.com/store/apps/details?id=com.hextris.hextris' target='_blank'>Android</a><br>More @ the <a href ='http://hextris.github.io/' target='_blank'>Hextris Website</a>");
if (gameState == 1) {
pause();
}

View file

@ -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) {