fixed conflicts around input.js and pausing

This commit is contained in:
meadowstream 2014-05-24 16:04:57 -04:00
commit 70b404e161
2 changed files with 16 additions and 19 deletions

View file

@ -2,23 +2,25 @@
keypress.register_combo({
keys: "left",
on_keydown: function() {
MainClock.rotate(1);
if (MainClock) {
MainClock.rotate(1);
}
}
});
keypress.register_combo({
keys: "right",
on_keydown: function() {
MainClock.rotate(-1);
if (MainClock){
MainClock.rotate(-1);
}
}
});
keypress.register_combo({
keys: "enter",
on_keydown: function() {
if (gameState == 0 || gameState == 2) {
init();
}
init();
}
});
@ -27,6 +29,9 @@ keypress.register_combo({
on_keydown: function() {
if (Math.abs(gameState) == 1) {
gameState = -gameState;
}
if (gameState == 1) {
requestAnimFrame(animLoop);
}
}
@ -66,16 +71,4 @@ var tapRight = Hammer(document.getElementById("rightTap")).on("tap", function(ev
init();
}
MainClock.rotate(-1);
});
// keypress.register_combo({
// keys: "space",
// on_keyup: function() {
// iter = 1; // <- 1337 hax that reset speed anywhere in the game
// scoreAdditionCoeff = 1;
// },
// on_keydown: function() {
// iter = 2;
// scoreAdditionCoeff = 2;
// }
// });
});

View file

@ -24,6 +24,7 @@ $('#clickToExit').bind('click', toggleDevTools);
function toggleDevTools() {
$('#devtools').toggle();
}
var firstTime = 1;
var gameState = 0;
var framerate = 60;
var history = {};
@ -69,7 +70,10 @@ function init() {
startTime = Date.now();
waveone = new waveGen(MainClock,Date.now(),[1,1,0],[1,1],[1,1]);
console.log(waveone);
requestAnimFrame(animLoop);
if (firstTime) {
firstTime = 0;
requestAnimFrame(animLoop);
}
}
function addNewBlock(blocklane, color, iter, distFromHex, settled) { //last two are optional parameters