aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Leah Alpert <lalpert@mit.edu>2011-08-28 22:08:22 -0700
committerGravatar Leah Alpert <lalpert@mit.edu>2011-08-28 22:08:22 -0700
commitf806f3e8eef433774d844461ad9cd344d59b840e (patch)
treef45764e09248d8c4a6805d62abd220c341936d05
parentc9c1bf98579995c673b56e79ea973d269320fac5 (diff)
Allow shape to be rotated and moved even if it will go off the top of the board. most noticeable on blue line pieces.
-rw-r--r--tetris.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tetris.py b/tetris.py
index 885c97f..fd67ae2 100644
--- a/tetris.py
+++ b/tetris.py
@@ -118,13 +118,14 @@ class Board():
That is; if there is a 'landed' block there or it is outside the
board boundary, then return False, otherwise return true.
"""
- if x < 0 or x >= self.max_x or y < 0 or y >= self.max_y:
+ if x < 0 or x >= self.max_x or y < -3 or y >= self.max_y:
return False
elif self.landed.has_key( (x, y) ):
return False
else:
return True
+
#represents a player. each player has a board, other player's board,
#current shape, score, etc
class Player():
@@ -371,7 +372,8 @@ class TetrisGame(object):
if p.shape:
blocks = p.shape.blocks
for b in blocks:
- d[(b.x+offset*n,b.y)] = b.color
+ if b.y >= 0:
+ d[(b.x+offset*n,b.y)] = b.color
#score
score = p.score