Fixed time display in win message.

This commit is contained in:
Storm Dragon 2019-11-27 14:55:02 -05:00
parent c6c00a50a0
commit 4db7cfeb9e
2 changed files with 14 additions and 6 deletions

View File

@ -48,9 +48,11 @@ def game(mode):
i = -1
sounds['error'].play()
endTime = round(time.time() - startTime, 2)
message = [
"Congratulations! You beat Numnastics in " + str(tries) + " tries.",\
"Your time was " + str(int(endTime / 60)) + "minutes and " + str(round(endTime % 60, 2)) + " seconds."]
message = ["Congratulations! You beat Numnastics in " + str(tries) + " tries."]
if int(endTime / 60) == 1:
message.append("Your time was " + str(int(endTime / 60)) + " minute and " + str(round(endTime % 60, 2)) + " seconds.")
else:
message.append("Your time was " + str(int(endTime / 60)) + " minutes and " + str(round(endTime % 60, 2)) + " seconds.")
display_message(message)
sounds['win'].play()
time.sleep(sounds['win'].get_length())

View File

@ -27,6 +27,13 @@ def write_config(writeGlobal = False):
with open(globalPath, 'w') as configfile:
globalConfig.write(configfile)
def read_config(section, value, readGlobal = False):
if readGlobal == False:
with open(gamePath, 'r') as configfile:
return localConfig.read(section, value)
else:
return globalConfig.read(section, value)
def speak(text, interupt = True):
if interupt == True: spd.cancel()
spd.say(text)
@ -151,7 +158,6 @@ def game_menu(*options):
event = pygame.event.clear()
time.sleep(0.001)
def donate(*mode):
subprocess.call(["xdg-open", "https://liberapay.com/stormdragon2976/donate"])
def donate():
pygame.mixer.music.pause()
mode = "menu"
subprocess.call(["xdg-open", "https://liberapay.com/stormdragon2976/donate"])