TGAME

mail@pastecode.io avatar
unknown
python
a month ago
2.3 kB
1
Indexable
Never
import sys,time,random

window = 0
typing_speed = 30
response = "base"
inventory = ["[Banana]", "[TenZ]", "[Griddy]"]
def slowType(t):
    for l in t:
        sys.stdout.write(l)
        sys.stdout.flush()
        time.sleep(random.random()/ typing_speed)
    print ('')

def Prompt(prompt, a, b):
    while True:
        slowType(f"{prompt}\nWhere would you like to go?")
        response = input()
        response = response.lower()
        if response == a or b:
            return response
        else:
            match response:
                case "help":
                    slowType("\n---------\nHelp Menu\n---------\nTo go somewhere, type 'Go' followed by the location of which you are going to e.g. 'Go Door' or 'Go Window'\nTo check your inventory type 'Inventory'\nTo use an item type \"Use\" followed by the item name e.g. \"Use Ladder\", or \"Use File\"\nIf you want to look around, type \"Look\"\n")
                case "inventory":
                    print("Your inventory:")
                    for item in inventory:
                        print(f"\t{item}")
                case "look":
                    pass
                case _:
                    print("Type \"Help\" if you need help")

def Dungeon():
    response = Prompt("There is a [Door] to your left and a [Window] to your right.", "window", "door")
    response = response.lower()
    if response == "window":
        Window()
    else:
        Door()

def Window():
    slowType("You stumble to the window, its large dark frame intimidates you as you realise the only way you can get up is if you had a ladder and a file.")
    for item in inventory:
        if item == "[Ladder]":
            pass       
    response = Prompt("With nothing else to do, you notice a small [Compartment] with a 5 digit lock, or you could just go to back to the main [Dungeon]", "compartment", "dungeon")
    response = response.lower()
    if response == "dungeon":
        Dungeon()
    else:
        Compartment()

def Door():
    slowType("You approach the door and grab for the handle.")


#MAIN PROGRAM
slowType("You wake up in the depth of a dark dungeon, \nYou dont remember how you got here but all you know is you need to get out\n")
Dunegon()

Leave a Comment