You can now actually lose the game.

This commit is contained in:
Robert Kolner committed 2012-03-15 17:24:42 +01:00
1 parent 27b7ba6311
commit 18df86378c
2 files changed
+26 -21

No files matched your search

+6 -3
View File
@@ -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();
});
});