mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
refactor(game)
This commit is contained in:
parent
080ba1b9cb
commit
c8859bc571
@ -46,6 +46,9 @@ class Main(BaseScreen, SceenElement, TextScreen):
|
||||
|
||||
def run(self) -> None:
|
||||
while True:
|
||||
self.run_game_loop()
|
||||
|
||||
def run_game_loop(self) -> None:
|
||||
if not self.game:
|
||||
self.draw()
|
||||
|
||||
|
||||
@ -341,6 +341,7 @@ class Tetris(BaseScreen):
|
||||
|
||||
def _play_landing_sound(self) -> None:
|
||||
"""Play the landing sound effect."""
|
||||
if self.game_mode is GameMode.PLAYER:
|
||||
self.landing_sound.play()
|
||||
|
||||
def _update_display_surface(self) -> None:
|
||||
|
||||
@ -17,4 +17,5 @@ __all__ = [
|
||||
"Rotation",
|
||||
"GameMode",
|
||||
"Weights",
|
||||
"BestMove",
|
||||
]
|
||||
|
||||
@ -15,4 +15,4 @@ class Size(NamedTuple):
|
||||
|
||||
class BestMove(NamedTuple):
|
||||
rotation: int
|
||||
direction: Direction
|
||||
x: int
|
||||
|
||||
Loading…
Reference in New Issue
Block a user