Python RPG help

Posts 1–2 of 2 · Page 1 of 1
Python RPG help
I'm having a small problem when I go to the mini zombie to interact with it non of this code executes. When I do move to the zombie it just notifies me that im there and stops. Any information would be appreciated thanks!!
Code:
def mini_zombie():
    actions_dict = {"check":"you lick your lips staring at the mini zombie ready to eat.",
                    "poke":" You pull out your new sword and poke at the zombie to try and wake him up.",
                    "chew":"You pick up the zombie and toss it into your mouth and proceed to chew it like bubble gum. "}
    while True:
        action = input("what do you do? [check | poke | chew] ")
        if action in actions_dict.keys():
            print(actions_dict[action])
            if action == "check":
                print(" You inch closer and closer to the zombie licking your lips. You can't stop thinking about eating its BRAINS!!")
                print(" You ate the zombie and fell through a trap door you are now free to go home")
                return
            elif action == "chew":
                you_died(" As you tried to blow a bubble with the chewed up zombie it came back to life and melted down your throat. You died. \n<Game Over>")
Full code:
Code:
you_died(why):
    print(f"{why}. Good Job")

    exit(0)

def mini_zombie():
    actions_dict = {"check":"you lick your lips staring at the mini zombie ready to eat.",
                    "poke":" You pull out your new sword and poke at the zombie to try and wake him up.",
                    "chew":"You pick up the zombie and toss it into your mouth and proceed to chew it like bubble gum. "}
    while True:
        action = input("what do you do? [check | poke | chew] ")
        if action in actions_dict.keys():
            print(actions_dict[action])
            if action == "check":
                print(" You inch closer and closer to the zombie licking your lips. You can't stop thinking about eating its BRAINS!!")
                print(" You ate the zombie and fell through a trap door you are now free to go home")
                return
            elif action == "chew":
                you_died(" As you tried to blow a bubble with the chewed up zombie it came back to life and melted down your throat. You died. \n<Game Over>")


def blue_hallway():
    box = ["sword", "tall goat", "cat treat", "extra life"]
    print("You walk down the hallway only to run into a wall of goats. You see a box to your right and a mini sleeping zombie on your left.")


    action = input(" What do you choose??")

    if action in ("box", "right"):
        print(" Look a box!! ")

        print("break it open ? press '1' ")
        print("kiss it? press '2' ")
        choice = input("")

        if choice == "1":
            print("SMASHH!!! /grins ")
            print("This item appears on the ground.")

            for items in box:
                print(items)

            print("what items do you wanna pick up?")

            num_items_in_box = len(box)

            print(f" Take all {num_items_in_box} items, press '1'" )
            print("leave it, press '2' ")

            item_choice= input("")
            if item_choice == "1":
                box.remove("sword")
                print("\tYou take the shinier sword from the box. It does looks exceedingly shiney.")
                print("\tWoohoo! Bounty and a shiney new sword. /drops your crappy sword in the empty treasure chest.")

                temp_box_list = box[:]
                box_contents = ", ".join(box)
                print(f"\tYou also receive {box_contents}.")

                for items in temp_box_list:
                    box.remove(items)

                box.append("Turd on a stick")
                print(f"\tYou drop the Turd on a stick to the ground for the next adventurer to play with.")
                print("Back to the tiny zombie.")
            elif item_choice == "2":
                print("why did you smash the box for nothing...")
        elif choice == "2":
            print("Im gonna eat the mini zombie :)")
    elif action in ["mini", "zombie", "sleeping", "left"]:
        print("i'm gonna eat the zombie.")
    else:
        print("I'm not sure what you picked. Let eat the zombie anyway.")



def red_hallway():
    print("You see a giant cat with ne eye!")
    print("It looks at you with an evil glare.")
    print("Do you flee or stay?")

    next_move = input(">  ")

    if "flee" in next_move:
        start_adventure()

    else:
        you_died("It eats you! Umm that was tasty!!")



def start_adventure():
    print(" You wake up in a dark room with a Blue hallway on your left and a Red hallway to the right. ")
    hallway_picked = input("Do you pick the Blue hallway or the Red hallway??")

    if hallway_picked == "red":
        red_hallway()

    elif hallway_picked == "blue":
        blue_hallway()

    else:
        print("It's red or blue that needs to be picked. Sorry you are the weakest link. Goodbye ")






def main():

    player_name = input(" What is your name? ")
    print(" Your name is {}. You are a {}.".format(player_name, "Radio DJ"))

    start_adventure()

if __name__ == '__main__':
    main()
you forgot to call the function 'mini_zombie'. i've attached an image showing the solution
MiniZombie.PNG75 KB · 4 downloads
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us