From 580130d99c798c9fb0034f4daba96f8357927f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 20 Jul 2017 14:17:28 +0200 Subject: Add score --- turtetris_master/game.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'turtetris_master/game.py') diff --git a/turtetris_master/game.py b/turtetris_master/game.py index 63987b0..3a5d463 100644 --- a/turtetris_master/game.py +++ b/turtetris_master/game.py @@ -120,7 +120,12 @@ class Game: def __show_score__(self): "Show score in bottom right" - pass + i = self.score % 5 + y = int(self.score / 5) + for ii in range(i): + self.matrix.pixel(self.matrix.width - 1, ii, 'green') + for yy in range(y): + self.matrix.pixel(self.matrix.width - 2, yy, 'green') def __place__(self): "Stone can't move so place it, check lines and generate new one" @@ -202,8 +207,7 @@ class Game: self.__rotate__() if input['left'] != input['right']: self.__move__(input['left']) - if self.step >= self.step_edge or \ - (input['down'] and self.step >= self.step_edge/3): + if self.step >= self.step_edge or input['down']: gameover = not self.__down__() self.step = 0 else: -- cgit v1.2.3