import os,time,sys lives = 5 def start_screen(): os.system('clear') f = open('startscreenart.ascii') for line in f.readlines(): print(line, end = "") print() print("welcome to the cave of doom text adventure!!!") time.sleep(5) intro_screen() def intro_screen(): os.system('clear') print("You wake up and it is dark...") time.sleep(1) print("You look around and you can see a torch.") time.sleep(1) choice = input("Pick up the torch?") if choice == "no": print("You lie down in the darkness until you die and are eaten by rats") elif choice == "yes": print("The torch illuminates the cave.") time.sleep(1) print("You see a book on the floor and a door ahead.") choice = input("Do you want to walk through the door or pick up the book?") if choice.lower() == "book": read_the_book() elif choice.lower() == "door": walk_through_the_door() else: print('invalid choice...') time.sleep(3) intro_screen() def walk_through_the_door(): global lives os.system('clear') print("there was a goblin on the other side. you lose a life") lives = lives - 1 if lives == 0: game_over() else: print("you have ", lives , "left") time.sleep(1) print("You run back through the door screaming and shut it behind you...") time.sleep(1) intro_screen() def read_the_book(): os.system('clear') def game_over(): print("Game over!") sys.exit() start_screen()