From ac7a44df81e9113a5b3d84702879fde890a3f9fc Mon Sep 17 00:00:00 2001 From: Frederic Date: Tue, 20 Dec 2016 12:55:26 +0100 Subject: [PATCH] don't draw blocks outside the playground area; spawn minos at y=-1 --- ttrs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ttrs.py b/ttrs.py index e98d646..d01a4b5 100755 --- a/ttrs.py +++ b/ttrs.py @@ -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(): 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