From cd128f5bc4fae39fb7e77683758d437f64eb4203 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sun, 24 Mar 2024 01:22:39 +0200 Subject: gameover, level x and level up screens --- src/sliceitoff/game/show.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/sliceitoff/game/show.py') diff --git a/src/sliceitoff/game/show.py b/src/sliceitoff/game/show.py index c3fe436..50ed0ba 100644 --- a/src/sliceitoff/game/show.py +++ b/src/sliceitoff/game/show.py @@ -1,5 +1,6 @@ """ Reads user input and does actions when game play is on. """ import pygame +from .anykey import anykey class Show: """ To show some sprites and quit on any key """ @@ -13,21 +14,13 @@ class Show: return False if self.timeout < 0: - for event in pygame.event.get(): - if event.type in ( - pygame.MOUSEBUTTONDOWN, - pygame.KEYDOWN, - pygame.QUIT): - return False + if anykey(): + return False self.fadeout -= dt self.sprites.update(explode=dt) return True - for event in pygame.event.get(): - if event.type in ( - pygame.MOUSEBUTTONDOWN, - pygame.KEYDOWN, - pygame.QUIT): - self.timeout = 0 + if anykey(): + self.timeout = 0 self.timeout -= dt return True -- cgit v1.2.3