refactor(game)

This commit is contained in:
Kristofers Solo 2024-01-06 23:18:10 +02:00
parent 080ba1b9cb
commit c8859bc571
4 changed files with 13 additions and 8 deletions

View File

@ -46,6 +46,9 @@ class Main(BaseScreen, SceenElement, TextScreen):
def run(self) -> None: def run(self) -> None:
while True: while True:
self.run_game_loop()
def run_game_loop(self) -> None:
if not self.game: if not self.game:
self.draw() self.draw()

View File

@ -341,6 +341,7 @@ class Tetris(BaseScreen):
def _play_landing_sound(self) -> None: def _play_landing_sound(self) -> None:
"""Play the landing sound effect.""" """Play the landing sound effect."""
if self.game_mode is GameMode.PLAYER:
self.landing_sound.play() self.landing_sound.play()
def _update_display_surface(self) -> None: def _update_display_surface(self) -> None:

View File

@ -17,4 +17,5 @@ __all__ = [
"Rotation", "Rotation",
"GameMode", "GameMode",
"Weights", "Weights",
"BestMove",
] ]

View File

@ -15,4 +15,4 @@ class Size(NamedTuple):
class BestMove(NamedTuple): class BestMove(NamedTuple):
rotation: int rotation: int
direction: Direction x: int