diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-12-22 22:39:47 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-12-22 23:33:47 +0100 |
commit | 9fc44219df19a62b27e87eaa35e9687b677c6f65 (patch) | |
tree | b2000054d87f0fc36a3b6df4585c487b4c203e95 | |
parent | 478fe4ea0a58eb89c91eb485ad351640c20ff8af (diff) |
Display the level number
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rwxr-xr-x | cameltris.py | 6 |
1 files 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 |