My python game


#1

friend = ["not found"]
import time
def introtwo():
    print("[STARTING PART TWO]")
    print("[LOADING PART TWO BACKSTORY]")
    print("[BACKSTORY]")
    print("you and the zombie made friends...")
    print("you kill all zombies and restore humanity...")
    print("you are still a zombie...")
    print("the militry capture you and keep you locked up...")
    print("two tasks...")
    print("find your friend...")
    print("Escape...")
    print("hurry the military are on to you")
    placestwo()
def intro():
    print("[---ZOMBIES-BY-HARRISON-SHEILS---]")
    time.sleep(3)
    print("[---LOADING-ZOMBIES---]")
    time.sleep(3)
    print("[---LOADING-PLACES---]")
    time.sleep(3)
    print("[---LOADING-TEXT---]")
    time.sleep(3)
    print("[---LOADING-GAME---]")
    time.sleep(3)
    print("[---STARTING-GAME---]")
    time.sleep(3)
    print("[---LOADING-BACKSTORY---]")
    time.sleep(3)
    name = input("Enter your name to start game: ")
    print("please read backstory")
    time.sleep(2)
    print("[BACKSTORY]")
    time.sleep(2)
    print("You are a zombie called " + name)
    time.sleep(2)
    print("You got infected in a zombie apocalypse...")
    time.sleep(2)
    print("You got your senses back but you are still a zombie...")
    time.sleep(2)
    print("Your mission is to find other zombies that have their senses.")
    time.sleep(2)
    placesone()
def placesone():
    print ("input 1 to go to the carpet factory")
    print ("input 2 to go to the cinema")
    print ("input 3 to go to the bowling alley")
    print ("input 4 to go to the old market")
    print ("input 5 to go to the resturaunt")
    print ("input 6 to restart game")
    print ("input 7 to exit game")
    placeschoice = input("please enter a place number: ")
    if placeschoice == "1":
        carpetfactory()
    elif placeschoice == "2":
        cinema()
    elif placeschoice == "3":
        bowlingalley()
    elif placeschoice == "4":
        oldmarket()
    elif placeschoice == "5":
        resturaunt()
    elif placeschoice == "6":
        print ("[RESTARTING GAME]")
        intro()
    elif placeschoice == "7":
        print ("[SHUTTING DOWN GAME]")
        print ("please select ok when asked to kill code to exit game")
        exit()
    else:
        print ("please input a valid number!")
        placesone()
def carpetfactory():
    print ("please input 1 to try to slay the zombies")
    print ("please input 2 to go back to the city centre and go to a differant places")
    carpetfactorychoice = input("You are in an abandoned carpet factory full of zombies do you try to slay them? or do you go back to the city centre?")
    if carpetfactorychoice == "1":
        print ("You try to slay the zombies but there are too many of them you die")
        print ("[GAMEOVER]")
        intro()
    elif carpetfactorychoice == "2":
        placesone()
    else:
        print ("please input a valid number!")
        carpetfactory()
def cinema():
    print ("please input 1 to go to city centre")
    cinemachoice = input("You are in an abandoned cinema but there is nothing there please return to the city centre!")
    if cinemachoice == "1":
        placesone()
    else:
        print ("Please enter a valid number")
        cinema()
def oldmarket():
    print ("please enter 1 to try and slay the zombies")
    print ("please enter 2 to go to the city centre")
    oldmarketchoice = input("You are in the old market there are zombies everywhere do you try and slay them? or do you go to the city centre?")
    if oldmarketchoice == "1":
        print ("You try to slay the zombies but there are too many of them and you die!")
        print ("[GAMEOVER]")
        exit()
    elif oldmarketchoice == "2":
        placesone()
    else:
        print ("Please input a valid number")
        oldmarket()
def resturaunt():
    print ("please input 1 to go back to back to city centre")
    resturauntchoice = input("You are in a resturaunt but there is no one there please return to city centre!")
    if resturauntchoice == "1":
        placesone()
    else:
        print ("please enter a valid number!")
        resturaunt()
        friend = ["not found"]

def introtwo():
    print("[STARTING PART TWO]")
    print("[LOADING PART TWO BACKSTORY]")
    print("[BACKSTORY]")
    print("you and the zombie made friends...")
    print("you kill all zombies and restore humanity...")
    print("you are still a zombie...")
    print("the militry capture you and keep you locked up...")
    print("two tasks...")
    print("find your friend...")
    print("Escape...")
    print("hurry the military are on to you")
    placestwo()
def bowlingalley():
    print ("please enter 1 to approach the zombie")
    print ("please enter 2 to go to the city centre")
    bowlingalleychoice = input("you are in a bowling alley and you see a zombie with their senses back do you approach them? or do you go back to the city centre?")
    if bowlingalleychoice == "1":
        print ("You approach the zombie with their sences they notice that you have your sences back aswell together you kill all the zombies and restore humanity!")
        print ("[CONGRATULATIONS YOU WIN PART 1! PART 2 IS STARTING!]")
        introtwo()
    elif bowlingalleychoice == "2":
        placesone()
    else:
        print ("Please enter a valid number!")
        bowlingalley()
def placestwo():
    print("input 1 to go to the weapon storage")
    print("input 2 to go to the militry base exit")
    print("input 3 to go to the cells")
    print("input 4 to go to the training centre")
    print("input 5 to restart whole game")
    print("input 6 to restart part two only")
    print("input 7 to exit the game")
    placestwochoice = input("please input a choice number: ")
    if placestwochoice == "1":
        weaponstorage()
    if placestwochoice == "2":
        militrybaseexit()
    if placestwochoice == "3":
        cells()
    if placestwochoice == "4":
        trainingcentre()
    if placestwochoice == "5":
        intro()
    if placestwochoice == "6":
        introparttwo()
    if placestwochoice == "7":
        exit()
def weaponstorage():
    if "not found" in friend:
        print ("input 1 to go to place choice")
        print ("input 2 to approach your friend")
        weaponstoragechoice = input("you are in a training centre you see your friend i would approach him and get out of the militry base!NOW!")
        if weaponstoragechoice == "1":
            placestwo()
        elif weaponstoragechoice == "2":
            print ("YOU HAVE YOUR FRIEND GET OUT THE EXIT NOW!")
            friend.remove("not found")
            friend.append("found")
            time.sleep(3)
            print("3...")
            time.sleep(3)
            print("2...")
            time.sleep(3)
            print("1...")
            time.sleep(3)
            placestwo()
        else:
            print("please input a number!")
            weaponstorage()
    elif "found" in friend:
        print ("GET OUT NOW!!!")
        time.sleep(3)
        print("3...")
        time.sleep(3)
        print("2...")
        time.sleep(3)
        print("1...")
        time.sleep(3)
        placestwo()
    else:
        print ("oops somethings gone wrong please restart the game")
        intro()
def militrybaseexit():
    if "found" in friend:
        print ("you get outside the militry base and see a huge hoard of zombies then you realise you didnt get rid of all the zombies! there will be a part 3!!!")
        print ("[CONGRATULATIONS! YOU WIN PART 2! PART 3 WILL START IN 10 SECONDS!]")
        time.sleep(10)
        introthree()
    elif "not found" in friend:
        print("you need to find your friend first!")
        placestwo()
    else:
        print ("Oops something has gone wron ginthis code please fix the error and continue playing")
        exit()
def cells():
    print("you are in a row of cells there is nothing here please go back to the place choice")
    print("3...")
    time.sleep(1)
    print("2...")
    time.sleep(1)
    print("1...")
    time.sleep(1)
    placestwo()
def trainingcentre():
    print("you are in the military base training centre there is nothing here that is useful you will be sent back to the place choice in...")
    print("3...")
    time.sleep(1)
    print("2...")
    time.sleep(1)
    print("1...")
    time.sleep(1)
    placestwo()
def introthree():
    print("[LOADING BACKSTORY]")
    print("[BACKSTORY]")
    print("you escaped the military base...")
    print("you realise now that it was a trap as soon as you stepped outside...")
    print("you was in a haunted house now you must find all the items and escape the house")
    print("starting part three...")
    time.sleep(3)
    print("3...")
    time.sleep(3)
    print("2...")
    time.sleep(3)
    print("1...")
    time.sleep(3)
    partthree()
def partthree():
    print("input 1 to go to the living room")
    print("input 2 to go to the bedroom")
    print("input 3 to go to the kitchen")
    print("input 4 to go to the basement")
    print("input 5 to go to the garage")
    print("input 6 to start from part 1")
    print("input 7 to start from part 2")
    print("input 8 to start from part 3")
    print("input 9 to exit the whole game")
    placechoice3 = input("please input a number now")
    if placechoice3 == "1":
        livingroom()
    if placechoice3 == "2":
        bedroom()
    if placechoice3 == "3":
        kitchen()
    if placechoice3 == "4":
        basement()
    if placechoice3 == "5":
        garage()
    if placechoice3 == "6":
        friend.clear()
        friend.append("not found")
        inventory.clear()
        intro()
    if placechoice3 == "7":
        inventory.clear()
        friend.remove("found")
        friend.append("not found")
        introtwo()
    if placechoice3 == "8":
        inventory.clear()
        introthree()
    if placechoice3 == "9":
        exit()
    else:
        print("please input an appropriate number")
        partthree()
inventory = []
def livingroom():
    print ("you are in a living room there are ghostily pictures every where there is a chest key on the mantle piece also there is a door through to the garage")
    print ("input 1 to pick up the key")
    print ("input 2 to go back to the main hallway")
    livingroomchoice = input("please enter a number now")
    if livingroomchoice == "1":
        inventory.append("chest key")
        print ("you pick up the key and go back to the main hallway")
        partthree()
    if livingroomchoice == "2":
        print ("you will now go to the main hallway")
    else:
        print ("please input a valid number")
def bedroom():
    print ("you are in a bedroom there is a locked chest under the bed")
    print ("please input 1 to open the chest")
    print ("please input 2 to go to the main hallway")
    bedroomchoice = input("please input a number now")
    if bedroomchoice == "1":
        if "chest key" in inventory:
            print ("you open the chest and there is a basement key")
            print ("YOU CAN NOW GO TO THE BASEMENT")
            inventory.append("basement key")
            print ("you will now be taken to the place choice screen")
            time.sleep(3)
            print("3...")
            time.sleep(3)
            print("2...")
            time.sleep(3)
            print("1...")
            time.sleep(3)
            partthree()
        elif "chest key" not in inventory:
            print ("sorry you cannot open this chest as you have no chest key")
            print ("you will now be taken back to the choice screen")
            time.sleep(3)
            print("3...")
            time.sleep(3)
            print("2...")
            time.sleep(3)
            print("1...")
            time.sleep(3)
            partthree()
        else:
            print("sorry something must have gone wrong with the coding...Sorry! :)")
            exit()
    elif bedroomchoice == "2":
        print ("you will now be taken to the place choice")
        time.sleep(3)
        print("3...")
        time.sleep(3)
        print("2...")
        time.sleep(3)
        print("1...")
        time.sleep(3)
        partthree()
    else:
        print ("please enter a valid number!")
        bedroom()
def kitchen():
    print ("you are in the kitchen and there is a locked cupboard and a locked backdoor you need to get out this backdoor")
    print ("input 1 to go open the locked cupboard")
    print ("input 2 to open the backdoor")
    print ("input 3 to go back to the choice screen")
    kitchenchoice = input("please enter your choice now")
    if kitchenchoice == "1":
        if "cupboard key" in inventory:
            print ("you open the cupboard and there is a backdoor key")
            print ("you now have the backdoor key")
            inventory.append("backdoor key")
            print ("you must stay in the kitchen and open the backdoor")
            kitchen()
        else:
            print("you do not have the cupboard key")
            print("get the key and come back")
            partthree()
    elif kitchenchoice == "2":
        if "backdoor key" in inventory:
            print("you open the backdoor and escape into the garden")
            print("[CONGRATULATIONS YOU WIN!]")
            print("[YOU WILL NOW EXIT THE GAME]")
            exit()
        elif "backdoor key" not in inventory:
            print("you have not found the backdoor key yet do some more exploring and come back when you find the key")
            kitchen()
        else:
            print("sorry something went wrong with the coding please try again")
            exit()
    elif kitchenchoice == "3":
        partthree()
    else:
        print("please enter a valid number")
        kitchen()
def basement():
    if "basement key" in inventory:
        print("you unlock the basement door and enter")
        print("there is a key on the floor")
        print("input 1 to pick up the key")
        print("input 2 to go to place choice")
        basementchoice = input("please enter your choice now")
        if basementchoice == "1":
            print("you pick up the key and you find that it is the kitchen cupboard key")
            inventory.append("cupboard key")
            print("you now have the cupboard key in your inventory")
            print("you will go to the place choice")
            partthree()
        elif basementchoice == "2":
            print("you will be taken to the place choice")
            partthree()
        else:
            print("sorry please enter a valid number")
            basement()
    elif "basement key" not in inventory:
        print("you do not have the basement key you must go back and find it")
        print("you will now go back to place choice")
        partthree()
    else:
        print("sorry something has gone wrong with the coding")
        exit()
def garage():
    print("you enter the garage there is a car with headlights on.")
    print("you see a ghostly figure in the car the car revs.")
    print("the car lurches forward at you")
    print("[GAME OVER]")
    time.sleep[10]
    exit()

intro()

#3

every time it asks for input, I can't get past it