Fixed time display in win message.
This commit is contained in:
parent
c6c00a50a0
commit
4db7cfeb9e
@ -48,9 +48,11 @@ def game(mode):
|
|||||||
i = -1
|
i = -1
|
||||||
sounds['error'].play()
|
sounds['error'].play()
|
||||||
endTime = round(time.time() - startTime, 2)
|
endTime = round(time.time() - startTime, 2)
|
||||||
message = [
|
message = ["Congratulations! You beat Numnastics in " + str(tries) + " tries."]
|
||||||
"Congratulations! You beat Numnastics in " + str(tries) + " tries.",\
|
if int(endTime / 60) == 1:
|
||||||
"Your time was " + str(int(endTime / 60)) + "minutes and " + str(round(endTime % 60, 2)) + " seconds."]
|
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)
|
display_message(message)
|
||||||
sounds['win'].play()
|
sounds['win'].play()
|
||||||
time.sleep(sounds['win'].get_length())
|
time.sleep(sounds['win'].get_length())
|
||||||
|
@ -27,6 +27,13 @@ def write_config(writeGlobal = False):
|
|||||||
with open(globalPath, 'w') as configfile:
|
with open(globalPath, 'w') as configfile:
|
||||||
globalConfig.write(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):
|
def speak(text, interupt = True):
|
||||||
if interupt == True: spd.cancel()
|
if interupt == True: spd.cancel()
|
||||||
spd.say(text)
|
spd.say(text)
|
||||||
@ -151,7 +158,6 @@ def game_menu(*options):
|
|||||||
event = pygame.event.clear()
|
event = pygame.event.clear()
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|
||||||
def donate(*mode):
|
def donate():
|
||||||
subprocess.call(["xdg-open", "https://liberapay.com/stormdragon2976/donate"])
|
|
||||||
pygame.mixer.music.pause()
|
pygame.mixer.music.pause()
|
||||||
mode = "menu"
|
subprocess.call(["xdg-open", "https://liberapay.com/stormdragon2976/donate"])
|
||||||
|
Loading…
Reference in New Issue
Block a user