Untitled
unknown
plain_text
2 years ago
1.8 kB
5
Indexable
import time import random def wait_for_user(): input("\nPress Enter to continue...") def print_slow(text, delay=0.03): for char in text: print(char, end='', flush=True) time.sleep(delay) print() def display_intro(): print_slow("You find yourself in a dark, eerie forest. It's foggy, and you can barely see ahead.\n") time.sleep(1) print_slow("Your objective is to find your way out of this horror-infested forest.\n") time.sleep(1) def forest_path(): print_slow("You follow a path into the dense forest.\n") time.sleep(1) while True: print("\nWhat do you want to do?") print("1. Continue walking.") print("2. Look around.") print("3. Quit the game.") choice = input("Enter your choice (1/2/3): ") if choice == '1': encounter = random.choice(['monster', 'empty', 'item']) if encounter == 'monster': print_slow("\nA terrifying monster jumps out of the shadows and attacks you!\n") print_slow("You're too scared to fight back... You didn't make it out alive.") break elif encounter == 'empty': print_slow("\nYou continue walking, but the forest seems endless.") else: print_slow("\nYou found a helpful item! Keep going.") elif choice == '2': print_slow("\nThe dense fog makes it hard to see anything around.") elif choice == '3': print_slow("\nYou decide to quit the game. Come back soon!") break else: print_slow("\nInvalid choice. Try again.") def main(): display_intro() forest_path() if __name__ == "__main__": main()
Editor is loading...