From ac138f4369fc264bcbea3a7ccd9c0536a3b82e43 Mon Sep 17 00:00:00 2001 From: Robert Kolner Date: Wed, 21 Nov 2012 18:36:13 +0100 Subject: [PATCH] Fixed a bug with brick being doubled. --- tetris.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tetris.js b/tetris.js index c2514f9..eaeaf77 100644 --- a/tetris.js +++ b/tetris.js @@ -221,7 +221,10 @@ function TetrisGame(canvasId, linesCounterId, nextBricksCanvasId) { } this.integrateCurrentIntoBoard = function () { - + if (this.currentBrickId == 0) { + return true; + } + var shape = this.brickShape(this.currentBrickId, this.currentBrickRot); for (var i = 0; i < 4; i++) { var x = this.currentBrickLoc[0]+shape[i][0]; @@ -233,6 +236,9 @@ function TetrisGame(canvasId, linesCounterId, nextBricksCanvasId) { } this.board[x][y] = this.bricks[this.currentBrickId]; + this.currentBrickId = 0; + this.currentBrickLoc = 0; + this.currentBrickRot = 0; } }