summaryrefslogtreecommitdiff
path: root/cameltris.py
diff options
context:
space:
mode:
Diffstat (limited to 'cameltris.py')
-rwxr-xr-xcameltris.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cameltris.py b/cameltris.py
index d3973be..63c8735 100755
--- a/cameltris.py
+++ b/cameltris.py
@@ -140,6 +140,16 @@ def refresh_game_canvas():
if element is not None:
game_canvas.blit(element, ((col_idx + current_piece_position[1]) * 50 + 1, (row_idx + current_piece_position[0]) * 50 + 1))
+def refresh_right_pane_canvas():
+ score_canvas.fill(black)
+
+ if pygame.font:
+ score_font = pygame.font.Font(None, 56)
+
+ score_canvas.blit(score_font.render(f"{score:08d}", True, white), (0, 0))
+ right_pane_canvas.blit(score_canvas, (2, 10))
+
+
def refresh_piece_preview_canvas():
piece_preview_canvas.fill(black)
@@ -168,6 +178,7 @@ def refresh_piece_preview_canvas():
def refresh_screen():
refresh_game_canvas()
screen.blit(game_canvas, (0, 0))
+ refresh_right_pane_canvas()
screen.blit(right_pane_canvas, (501, 0))
@@ -288,8 +299,6 @@ def stick_piece():
score += int(level * 40 * rate)
- print("Score is ", score)
-
if lines_burnt >= level * 10:
level += 1
print("Level up to ", level)
@@ -317,6 +326,7 @@ right_pane_canvas = pygame.Surface((300, 1000))
right_pane_canvas.fill((255, 255, 255))
piece_preview_canvas = pygame.Surface((200, 200))
+score_canvas = pygame.Surface((296, 50))
grid = [[None for _ in range(10)] for _ in range(20)]