Browse Source

poor man's drop prevention

master
Fr3deric 8 years ago committed by Frederic
parent
commit
b87c644ece
  1. 4
      ttrs.py

4
ttrs.py

@ -338,6 +338,7 @@ class TtrsGame(threading.Thread):
TICK_TIME = 0.1 TICK_TIME = 0.1
FALL_INTERVAL = 5 FALL_INTERVAL = 5
MOVE_INTERVAL = 1 MOVE_INTERVAL = 1
DROP_BARRIER = 4
ticks = 0 ticks = 0
lastfall = 0 lastfall = 0
lastmove = 0 lastmove = 0
@ -398,7 +399,8 @@ class TtrsGame(threading.Thread):
to_add.add(newb) to_add.add(newb)
self.playground.blocks.update(to_add) 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 lastfall = ticks
try: try:
mino.move(Point(0, 1)) mino.move(Point(0, 1))

Loading…
Cancel
Save