This commit is contained in:
Michael Yang 2014-05-25 21:49:18 -04:00
commit 41afa3ca46
2 changed files with 14 additions and 2 deletions

View file

@ -25,7 +25,7 @@ keypress.register_combo({
gameState = prevGameState; gameState = prevGameState;
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
} }
else { else if(gameState != -2 && gameState != 0) {
prevGameState = gameState; prevGameState = gameState;
gameState = -1; gameState = -1;
} }

View file

@ -249,10 +249,22 @@ function animLoop() {
} }
requestAnimFrame(animLoop); requestAnimFrame(animLoop);
function isInfringing(clock){
for(var i=0;i<clock.sides;i++){
var subTotal=0;
for(var j=0;j<clock.blocks[i].length;j++){
subTotal+=clock.blocks[i][j].deleted ;
}
if(clock.blocks[i].length- subTotal>settings.rows){
return true;
}
}
return false;
}
function checkGameOver() { function checkGameOver() {
for (var i = 0; i < MainClock.sides; i++) { for (var i = 0; i < MainClock.sides; i++) {
if (MainClock.blocks[i].length > settings.rows) { if (isInfringing(MainClock)) {
return true; return true;
} }
} }