Browse Source

don't draw blocks outside the playground area; spawn minos at y=-1

feature/balanceutils
Fr3deric 8 years ago committed by Frederic
parent
commit
ac7a44df81
  1. 5
      ttrs.py

5
ttrs.py

@ -173,6 +173,9 @@ class Playground(): @@ -173,6 +173,9 @@ class Playground():
for y in range(self.height):
frame.setPixel(xpos + x, ypos + y, (0, 0, 0))
for b in set.union(self.blocks, *[ m.blocks for m in self.minos ]):
if not self.contains_points([b.pos]):
# don't draw blocks outside the playground area
continue
frame.setPixel(xpos + int(b.pos.x), ypos + int(b.pos.y), b.color)
class TtrsPlayer():
@ -248,7 +251,7 @@ class TtrsGame(): @@ -248,7 +251,7 @@ class TtrsGame():
def run(self):
self.running = True
spawnpos = Point(self.playground.width // 2, 0)
spawnpos = Point(self.playground.width // 2, -1)
mino = None
TICK_TIME = 0.1
FALL_INTERVAL = 5

Loading…
Cancel
Save