Improved pause_game.
This commit is contained in:
parent
3862b36d56
commit
db6c34f714
21
__init__.py
21
__init__.py
@ -318,11 +318,28 @@ def play_bgm(music_file):
|
|||||||
def pause_game():
|
def pause_game():
|
||||||
"""Pauses the game"""
|
"""Pauses the game"""
|
||||||
speak("Game paused, press backspace to resume.")
|
speak("Game paused, press backspace to resume.")
|
||||||
|
try:
|
||||||
|
pygame.mixer.pause()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
pygame.mixer.music.pause()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
event = pygame.event.wait()
|
event = pygame.event.wait()
|
||||||
if event.type == pygame.KEYDOWN and event.key == pygame.K_BACKSPACE: return
|
if event.type == pygame.KEYDOWN and not event.key == pygame.K_BACKSPACE: continue
|
||||||
|
try:
|
||||||
|
pygame.mixer.pause()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
pygame.mixer.music.pause()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def get_input(prompt="Enter text:", text=""):
|
def get_input(prompt="Enter text:", text=""):
|
||||||
"""Display a dialog box for text input.
|
"""Display a dialog box for text input.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user