Allow to quit again, keep the score after the game is over.
parent
c1f1c85d45
commit
dd49ec5b5c
6
game.py
6
game.py
|
@ -68,12 +68,16 @@ def main():
|
||||||
timeleft -= time_passed / 1000
|
timeleft -= time_passed / 1000
|
||||||
timeleft = round(timeleft, 2)
|
timeleft = round(timeleft, 2)
|
||||||
|
|
||||||
|
|
||||||
if timeleft <= 0:
|
if timeleft <= 0:
|
||||||
screen_width, screen_height = size
|
screen_width, screen_height = size
|
||||||
screen.blit(game_over, (screen_width/3, screen_height/2))
|
screen.blit(game_over, (screen_width/3, screen_height/2))
|
||||||
displaytime = 'Timed out!'
|
displaytime = 'Timed out!'
|
||||||
|
# Redraw the HUD
|
||||||
|
the_hud.draw_hud(score, displaytime, round(fps, 2))
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
running = False
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
displaytime = timeleft
|
displaytime = timeleft
|
||||||
|
|
Loading…
Reference in New Issue