You can now actually lose the game.
This commit is contained in:
1 parent
27b7ba6311
commit
18df86378c
2 files changed
+26
-21
No files matched your search
+6
-3
@@ -2,8 +2,11 @@ var game = null;
|
||||
|
||||
function doTurn() {
|
||||
document.onkeypress = onKeyPressed;
|
||||
game.doTurn();
|
||||
window.setTimeout(doTurn, 333);
|
||||
if (game.doTurn()) {
|
||||
window.setTimeout(doTurn, 333);
|
||||
} else {
|
||||
alert('You lost!');
|
||||
}
|
||||
}
|
||||
|
||||
function onKeyPressed(e) {
|
||||
@@ -31,4 +34,4 @@ function onKeyPressed(e) {
|
||||
$(document).ready(function() {
|
||||
game = new TetrisGame("tetris-board");
|
||||
doTurn();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user