Added donate option. Got rid of the error that happened on exit.
This commit is contained in:
parent
3d956ccf47
commit
8a1471f648
@ -56,8 +56,8 @@ def game(mode):
|
||||
return "menu"
|
||||
|
||||
# Game starts at main menu
|
||||
mode = game_menu("start game", "instructions", "credits", "exit_game")
|
||||
while True:
|
||||
mode = game_menu("start game", "instructions", "donate", "credits", "exit_game")
|
||||
while mode != "exit_game":
|
||||
if mode == "menu": mode = game_menu("start game", "instructions", "credits", "exit_game")
|
||||
if mode == "start game": mode = game(mode)
|
||||
time.sleep(.001)
|
||||
|
@ -32,6 +32,7 @@ def speak(text, interupt = True):
|
||||
|
||||
def exit_game():
|
||||
spd.close()
|
||||
pygame.mixer.music.stop()
|
||||
pygame.quit()
|
||||
exit()
|
||||
|
||||
@ -132,17 +133,25 @@ def game_menu(*options):
|
||||
event = pygame.event.wait()
|
||||
if event.type == pygame.KEYDOWN:
|
||||
if event.key == pygame.K_ESCAPE: exit_game()
|
||||
if event.key == pygame.K_DOWN and i < len(options) - 1: i = i + 1
|
||||
if event.key == pygame.K_UP and i > 0: i = i - 1
|
||||
if event.key == pygame.K_DOWN and i < len(options) - 1:
|
||||
i = i + 1
|
||||
pygame.mixer.music.unpause()
|
||||
if event.key == pygame.K_UP and i > 0:
|
||||
i = i - 1
|
||||
pygame.mixer.music.unpause()
|
||||
if event.key == pygame.K_RETURN:
|
||||
try:
|
||||
eval(options[i] + "()")
|
||||
continue
|
||||
except:
|
||||
pygame.mixer.music.fadeout(500)
|
||||
time.sleep(0.25)
|
||||
return options[i]
|
||||
continue
|
||||
speak(options[i])
|
||||
event = pygame.event.clear()
|
||||
time.sleep(0.001)
|
||||
|
||||
def donate(*mode):
|
||||
import subprocess
|
||||
subprocess.call(["xdg-open", "https://liberapay.com/stormdragon2976/donate"])
|
||||
pygame.mixer.music.pause()
|
||||
mode = "menu"
|
||||
|
Loading…
Reference in New Issue
Block a user