aboutsummaryrefslogtreecommitdiff
path: root/turtetris_master
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-07-21 15:15:23 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-07-21 15:15:23 +0200
commitca31e8da2442bb13327f4e9e1fe526d5dca07893 (patch)
tree88996af09e320c5af69c8778d3294986e033af70 /turtetris_master
parent3b07afd3b57af31044d46077ce3ad9f0d262e87f (diff)
downloadturris-tetris-1.1.tar.gz
turris-tetris-1.1.tar.bz2
turris-tetris-1.1.zip
Light game area as little as possiblev1.1
Diffstat (limited to 'turtetris_master')
-rw-r--r--turtetris_master/game.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/turtetris_master/game.py b/turtetris_master/game.py
index 40d2da7..92c5fa5 100644
--- a/turtetris_master/game.py
+++ b/turtetris_master/game.py
@@ -25,7 +25,7 @@ SHAPES = [
]
COLORS = [
- 'black',
+ '010101',
'FFFF00',
'88FF00',
'00FF88',
@@ -45,6 +45,9 @@ class Game:
self.mx = [None]*(matrix.width - 2)
for i in range(len(self.mx)):
self.mx[i] = [0]*matrix.height
+ for x in range(len(self.mx)): # Light game area up
+ for y in range(len(self.mx[x])):
+ matrix.pixel(x, y, COLORS[0])
self.stone_next = SHAPES[randrange(len(SHAPES))][:]
# Don't have to check result as it should always be successful
if not self.new_stone():
@@ -103,7 +106,7 @@ class Game:
if self.stone[x][y] != 0:
self.matrix.pixel(self.matrix.width - x - 3 - self.stone_x,
self.matrix.height - 1 - y - self.stone_y,
- 'black')
+ COLORS[0])
def __check_collision__(self, x, y, stone):
"Check if stone collides. Returns True of so."
@@ -126,11 +129,11 @@ class Game:
if ii < i:
self.matrix.pixel(self.matrix.width - 1, ii, 'green')
else:
- self.matrix.pixel(self.matrix.width - 1, ii, 'black')
+ self.matrix.pixel(self.matrix.width - 1, ii, COLORS[0])
if ii < y:
self.matrix.pixel(self.matrix.width - 2, ii, 'green')
else:
- self.matrix.pixel(self.matrix.width - 2, ii, 'black')
+ self.matrix.pixel(self.matrix.width - 2, ii, COLORS[0])
def __place__(self):
"Stone can't move so place it, check lines and generate new one"