Block falling working. /JL

This commit is contained in:
2025-04-22 20:59:52 +02:00
parent 2e3460dca5
commit 9696719067
3 changed files with 20 additions and 7 deletions

11
hud.py
View File

@@ -4,9 +4,6 @@ from enums import BrickColor
class Hud:
def __init__(self, screen_width, screen_height, tile_size, font_size=36, highscore_file="highscore.txt"):
self.score = 0
self.lines = 0
self.level = 0
self.highscore_file = highscore_file
self.highscore = self.load_highscore()
@@ -15,6 +12,8 @@ class Hud:
self.screen_width = screen_width
self.screen_height = screen_height
self.tile_size = tile_size
self.reset()
def load_highscore(self):
if os.path.exists(self.highscore_file):
@@ -45,9 +44,13 @@ class Hud:
def level_up(self):
self.level += 1
def reset(self, reset_score=True):
def reset(self, reset_score=True, reset_lines=True, reset_level=True):
if reset_score:
self.score = 0
if reset_lines:
self.lines = 0
if reset_level:
self.level = 1
def draw(self, screen):
# Score (top-left)