From 9fc44219df19a62b27e87eaa35e9687b677c6f65 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Tue, 22 Dec 2020 22:39:47 +0100 Subject: Display the level number Signed-off-by: Olivier Gayot --- cameltris.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cameltris.py b/cameltris.py index 9876aa3..5d1d9ba 100755 --- a/cameltris.py +++ b/cameltris.py @@ -141,13 +141,16 @@ def refresh_game_canvas(): 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(): + level_canvas.fill(black) 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)) + level_canvas.blit(score_font.render(f"{level:08d}", True, white), (0, 0)) right_pane_canvas.blit(score_canvas, (2, 10)) + right_pane_canvas.blit(level_canvas, (2, 70)) def refresh_piece_preview_canvas(): @@ -301,7 +304,6 @@ def stick_piece(): if lines_burnt >= level * 10: level += 1 - print("Level up to ", level) current_piece, current_piece_position = next_piece, next_piece_position next_piece, next_piece_position = generate_piece() refresh_piece_preview_canvas() @@ -328,6 +330,7 @@ right_pane_canvas.fill((255, 255, 255)) piece_preview_canvas = pygame.Surface((200, 200)) score_canvas = pygame.Surface((296, 50)) +level_canvas = pygame.Surface((296, 50)) grid = [[None for _ in range(10)] for _ in range(20)] @@ -345,7 +348,6 @@ score = 0 clock = pygame.time.Clock() -print("Level is ", level) lines_burnt = 0 das = 0 -- cgit v1.2.3