top of page

Text Based Python Game

For my IT 140 class I had to make a Text Based Game Design using Python 3.1

​

Instructions/Directions:

Hello! All of your friends are coming to your house warming and you would like to make Pastelillos de Guayaba (Guava Cheese Pastries) for your friends. But when you walk into the kitchen you notice the door to the refrigerator is open and all of the contents are gone! The puppy's footprints prove your new untrained puppy is the culprit. You must collect all the ingredients for the recipe without running into your puppy because he will eat everything in sight!!

​

Here is a snippet of my code!

#Gameplay Loop

while True:
    show_status()
    user_entered = input('Enter your move: ')
    user_input = user_entered.title()
    inventory_checker()
    desired_move = user_input.split(' ')
    action = desired_move[0]
    if len(desired_move) > 1:
        item = desired_move[1:]
        direction = desired_move[1]
        item = ' '.join(item)
    if action == 'Get':
        if item == rooms[current_room]['item']:
            if item not in inventory:
                inventory.append(rooms[current_room]['item'])
                print('{} retrieved!'.format(item))
            elif item in inventory:
                print('You already have the {}'.format(item))
            else:
                print(f'Can not get {item}')
        else:
            print(f'Can not get {item}')
    elif action == 'Go':
        try:
            desired_room = rooms[current_room][direction]
            current_room = desired_room
        except:
            print('Sorry, Can not go that way! :(')
    elif action == 'Exit':
        break
    else:
        print('Sorry, There was an error.')
    if inventory_checker() == False:
        break
    if current_room == 'Backyard':
        if len(inventory) < 7:
            print(loser_statement)
            print('Thanks for playing the game. I hope you enjoyed it! A+')
            break
        elif len(inventory) == 7:
            print(winner_statement)
            print('Thanks for playing the game. I hope you enjoyed it! A+')
            break

#CheatSheet

Here is a map of the house. This layout gives a clear visual of which ingredients are in each room. It also shows where the puppy is, whom you are trying to avoid. Try using this as a guide!

At the moment WIX does not support py files.

I have linked my GitHub! Click below to play my text based game!

While Loops

Dictionaries

If-Else Loops

Connect

Contact
Information

Department of Mathematics
Science Center

Fresno, Texas 77545

Greenville, South Carolina 29607

  • GitHub
  • LinkedIn

Thanks for submitting!

©2023 by Jaquasia Nicole Donald.

bottom of page