Merge branch 'master' of https://github.com/teamsnowman/hextris
This commit is contained in:
commit
41afa3ca46
2 changed files with 14 additions and 2 deletions
|
@ -25,7 +25,7 @@ keypress.register_combo({
|
|||
gameState = prevGameState;
|
||||
requestAnimFrame(animLoop);
|
||||
}
|
||||
else {
|
||||
else if(gameState != -2 && gameState != 0) {
|
||||
prevGameState = gameState;
|
||||
gameState = -1;
|
||||
}
|
||||
|
|
14
js/main.js
14
js/main.js
|
@ -249,10 +249,22 @@ function 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() {
|
||||
for (var i = 0; i < MainClock.sides; i++) {
|
||||
if (MainClock.blocks[i].length > settings.rows) {
|
||||
if (isInfringing(MainClock)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue