Untitled

 avatar
unknown
plain_text
22 days ago
3.3 kB
2
Indexable
import random
import time

def print_slow(str):
    """Function to print text slowly for dramatic effect"""
    for char in str:
        print(char, end='', flush=True)
        time.sleep(0.05)
    print()

def start_game():
    print_slow("You wake up in a dark, eerie room.")
    print_slow("You can't remember how you got here. Your heart races.")
    print_slow("The air feels cold and heavy, as if something is watching you.")
    
    first_choice()

def first_choice():
    print_slow("What will you do?")
    print("1. Check the door.")
    print("2. Look for a light source.")
    
    choice = input("> ")
    
    if choice == "1":
        check_door()
    elif choice == "2":
        look_for_light()
    else:
        print_slow("Please choose 1 or 2.")
        first_choice()

def check_door():
    print_slow("You approach the door slowly, and... it's locked.")
    print_slow("Suddenly, you hear something scraping on the other side of the door!")
    
    second_choice()

def look_for_light():
    print_slow("You feel around the walls and find a light switch.")
    print_slow("You flip it on, but nothing happens... and then the lights flicker!")
    print_slow("The room feels even darker now.")
    
    second_choice()

def second_choice():
    print_slow("What will you do next?")
    print("1. Open the window.")
    print("2. Explore the shadows in the room.")
    
    choice = input("> ")
    
    if choice == "1":
        open_window()
    elif choice == "2":
        explore_shadows()
    else:
        print_slow("Please choose 1 or 2.")
        second_choice()

def open_window():
    print_slow("You rush to the window and try to open it...")
    chance = random.randint(1, 3)
    
    if chance == 1:
        print_slow("The window shatters open, and a gust of cold wind rushes in!")
        print_slow("You feel a momentary sense of relief. Maybe you'll escape this place.")
        print_slow("But then, you hear footsteps behind you.")
        print_slow("You turn around and... nothing is there.")
        end_game()
    else:
        print_slow("The window is stuck, and as you struggle with it, a voice whispers your name...")
        end_game()

def explore_shadows():
    print_slow("You step toward the dark corner of the room.")
    print_slow("Suddenly, something brushes against your leg... cold and sharp!")
    print_slow("You turn, but all you can see is the darkness.")
    
    # Random event of something spooky
    spooky_event()

def spooky_event():
    print_slow("Something is in the room with you. You feel a cold breath on your neck!")
    
    chance = random.randint(1, 3)
    
    if chance == 1:
        print_slow("You manage to escape the shadows just in time, but you can still feel its presence.")
        print_slow("You run through the door and escape the room... for now.")
        end_game()
    else:
        print_slow("You feel a sharp pain, as if something has grabbed you from the shadows!")
        print_slow("A scream echoes in your ears...")
        end_game()

def end_game():
    print_slow("The game is over. Thank you for playing!")
    exit()

if __name__ == "__main__":
    start_game()
Editor is loading...
Leave a Comment