Removed duplicate code.
This commit is contained in:
parent
911b37085e
commit
4607302e05
@ -72,23 +72,6 @@ def initialize_gui(gameTitle):
|
|||||||
time.sleep(soundData['game-intro'].get_length())
|
time.sleep(soundData['game-intro'].get_length())
|
||||||
return soundData
|
return soundData
|
||||||
|
|
||||||
def display_message(info):
|
|
||||||
info.append("Press escape or enter to continue.")
|
|
||||||
info.reverse()
|
|
||||||
info.append("Use the up and down arrow keys to navigate this message.")
|
|
||||||
info.reverse()
|
|
||||||
i = 0
|
|
||||||
speak(str(info[0:len(info)]))
|
|
||||||
while True:
|
|
||||||
event = pygame.event.wait()
|
|
||||||
if event.type == pygame.KEYDOWN:
|
|
||||||
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return
|
|
||||||
if event.key == pygame.K_DOWN and i < len(info) - 1: i = i + 1
|
|
||||||
if event.key == pygame.K_UP and i > 0: i = i - 1
|
|
||||||
speak(info[i])
|
|
||||||
event = pygame.event.clear()
|
|
||||||
time.sleep(0.001)
|
|
||||||
|
|
||||||
def instructions():
|
def instructions():
|
||||||
# Read in the instructions file
|
# Read in the instructions file
|
||||||
try:
|
try:
|
||||||
|
@ -53,7 +53,7 @@ def game(mode):
|
|||||||
message.append("Your time was " + str(int(endTime / 60)) + " minute 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:
|
else:
|
||||||
message.append("Your time was " + str(int(endTime / 60)) + " minutes and " + str(round(endTime % 60, 2)) + " seconds.")
|
message.append("Your time was " + str(int(endTime / 60)) + " minutes and " + str(round(endTime % 60, 2)) + " seconds.")
|
||||||
display_message(message)
|
display_text(message)
|
||||||
sounds['win'].play()
|
sounds['win'].play()
|
||||||
time.sleep(sounds['win'].get_length())
|
time.sleep(sounds['win'].get_length())
|
||||||
return "menu"
|
return "menu"
|
||||||
|
Loading…
Reference in New Issue
Block a user