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): @@ -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): @@ -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))

Loading…
Cancel
Save