Fixed music not pausing when play is selected.
This commit is contained in:
parent
a9c2c4332d
commit
2c34f31a82
12
menu.py
12
menu.py
@ -182,11 +182,18 @@ def game_menu(sounds, playCallback=None, *customOptions):
|
|||||||
try:
|
try:
|
||||||
pygame.mixer.music.fadeout(500)
|
pygame.mixer.music.fadeout(500)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(f"Could not fade music: {e}")
|
||||||
pass
|
pass
|
||||||
playCallback()
|
playCallback()
|
||||||
else:
|
else:
|
||||||
# Otherwise return "play" to the caller
|
# Otherwise return "play" to the caller
|
||||||
|
try:
|
||||||
|
pygame.mixer.music.fadeout(500)
|
||||||
|
time.sleep(0.5)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Could not fade music: {e}")
|
||||||
|
pass
|
||||||
return "play"
|
return "play"
|
||||||
# Handle standard options directly
|
# Handle standard options directly
|
||||||
elif selectedOption in ["instructions", "credits", "learn_sounds", "high_scores", "donate"]:
|
elif selectedOption in ["instructions", "credits", "learn_sounds", "high_scores", "donate"]:
|
||||||
@ -228,7 +235,8 @@ def game_menu(sounds, playCallback=None, *customOptions):
|
|||||||
try:
|
try:
|
||||||
pygame.mixer.music.fadeout(500)
|
pygame.mixer.music.fadeout(500)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(f"Could not fade music: {e}")
|
||||||
pass
|
pass
|
||||||
return selectedOption
|
return selectedOption
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user