From a113316c4822ea029fdc0bceb8cf4e5bef665b22 Mon Sep 17 00:00:00 2001 From: Morgan Diment <dimentm@cardiff.ac.uk> Date: Wed, 26 Oct 2022 15:26:25 +0100 Subject: [PATCH] end game statement --- Group_game/game.py | 10 +++++++--- Group_game/leaderboard.py | 4 ++-- Group_game/level_2.py | 3 --- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Group_game/game.py b/Group_game/game.py index 0e166f2..ddd7bcc 100644 --- a/Group_game/game.py +++ b/Group_game/game.py @@ -371,8 +371,8 @@ def main(): # Main game loop while True: current_time = datetime.now() - time_taken = current_time - start_time - time_left = 1200 - time_taken.total_seconds() + time_used = current_time - start_time + time_left = 1200 - time_used.total_seconds() if time_penalty: time_left = time_left - 300 if time_left < 0: @@ -394,8 +394,12 @@ def main(): gas_starttime = datetime.now() location_entrance["entered"] = True if trap_door["open"]: + minutes = time_taken()[0] + seconds = time_taken()[1] + print() + print("WELL DONE! You have completed the escape room.") + print('You took', minutes, 'minutes and', seconds, 'seconds.') print() - print("(game ending)") break print_room(current_room) diff --git a/Group_game/leaderboard.py b/Group_game/leaderboard.py index 8169c0e..638b0c3 100644 --- a/Group_game/leaderboard.py +++ b/Group_game/leaderboard.py @@ -37,7 +37,7 @@ def append_leaderboard(seconds_used,filename): #time_used = 20 minutes - time r time = [round(minutes), round(seconds)] print("Congrats, enter your name on the leaderboard!") - name = input("What's your name? :") + name = input("What's your name? : ") print('Well done! '+name) print(f'You escaped in {time[0]} minutes and {time[1]} seconds') @@ -65,7 +65,7 @@ def append_leaderboard(seconds_used,filename): #time_used = 20 minutes - time r file.close() print("Input 'Yes' or 'No'") - userinput = input("Would you live to view the leaderboard? :") + userinput = input("Would you live to view the leaderboard? : ") userinput = userinput.lower() if userinput == 'yes': view_leaderboard(filename) diff --git a/Group_game/level_2.py b/Group_game/level_2.py index 982dcf0..c28b77d 100644 --- a/Group_game/level_2.py +++ b/Group_game/level_2.py @@ -9,7 +9,6 @@ import time def drink_wine(): - # need to add time deduction counter = 0 x = "" while counter < 3: @@ -46,8 +45,6 @@ def drink_wine(): counter += 1 time.sleep(4) x = 3 - # time_taken = time_taken - 360 - # remove wine from inventory return x -- GitLab