From 3806b6b9cd9a5fa8b4ef1e25b682f65259db2b89 Mon Sep 17 00:00:00 2001 From: Robert Kolner Date: Tue, 13 Mar 2012 17:56:29 +0100 Subject: [PATCH] Added check for validity of rotation. --- tetris.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tetris.js b/tetris.js index add6445..dbb65c1 100644 --- a/tetris.js +++ b/tetris.js @@ -126,8 +126,11 @@ function TetrisGame(id) { } this.canCurrentBrickRotate = function() { - /* TODO!! */ - return true; + return this.isValidBrickLoc( + this.currentBrickId, + this.currentBrickLoc, + (this.currentBrickRot + 1) % 4 + ); } this.moveCurrentBrickHorizontally = function(dx) {