From b87c644ece766c4d6cd39d4ef4c61c597f82e054 Mon Sep 17 00:00:00 2001 From: Frederic Date: Tue, 27 Dec 2016 15:16:21 +0100 Subject: [PATCH] poor man's drop prevention --- ttrs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ttrs.py b/ttrs.py index bdb7dbd..7f9a657 100755 --- a/ttrs.py +++ b/ttrs.py @@ -338,6 +338,7 @@ class TtrsGame(threading.Thread): TICK_TIME = 0.1 FALL_INTERVAL = 5 MOVE_INTERVAL = 1 + DROP_BARRIER = 4 ticks = 0 lastfall = 0 lastmove = 0 @@ -398,7 +399,8 @@ class TtrsGame(threading.Thread): to_add.add(newb) self.playground.blocks.update(to_add) - if ticks - lastfall >= FALL_INTERVAL or evt == PlayerEvent.DROP: + drop = evt == PlayerEvent.DROP and mino.pos.y > DROP_BARRIER + if ticks - lastfall >= FALL_INTERVAL or drop: lastfall = ticks try: mino.move(Point(0, 1))