Python Forum
Adding an inventory and a combat system to a text based adventure game
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding an inventory and a combat system to a text based adventure game
#1
Hello,

I am relatively new to Python and have started making a text-based adventure game. I have made the basic movement part of the game using a script similar to this:
rooms = {
    'kitchen': {
        'name': 'your kitchen', 
        'east': 'bedroom', 
        'north': 'bathroom',
        'text': 'You see your familliar kitchen bench.'},
    'bathroom': {
        'name': 'your bathroom', 
        'east': 'lounge', 
        'south': 'kitchen',
        'text': 'You see your toilet and basin, and Bob the rubber duck.'},
    'lounge': {
        'name': 'your lounge room', 
        'west': 'bathroom', 
        'south': 'bedroom',
        'text': 'You see your couch, which is facing your tv.'},
    'bedroom': {
        'name': 'your bedroom', 
        'north': 'lounge', 
        'west': 'kitchen',
        'text': 'You see your cozy bed piled with teddies.'}
    }
directions = ['north', 'south', 'east', 'west']
current_room = rooms['kitchen']

while True:
    print()
    print('You are in {}.'.format(current_room['name']))
    print(current_room['text'])
    command = input('\nWhat do you do? ').strip()
    if command in directions:
        if command in current_room:
            current_room = rooms[current_room[command]]
        else:
            print("You can't go that way.")
    elif command.lower() in ('q', 'quit', 'exit'):
        break
    else:
        print("I don't understand that command.")
I want to add an inventory system and a combat system to the game, but am not sure how to do that.

Thanks,
detkitten
Reply


Messages In This Thread
Adding an inventory and a combat system to a text based adventure game - by detkitten - Dec-17-2019, 03:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Game - Choice Based theor 4 3,066 May-22-2024, 01:17 PM
Last Post: alanbriggs
  [PyGame] adding mouse control to game flash77 7 576 May-21-2024, 01:05 AM
Last Post: XavierPlatinum
  Text-Based RPG - After selecting correct decision it also prints others code KimJiwoo1 1 1,061 Apr-26-2023, 08:30 PM
Last Post: deanhystad
  Complete beginnner making a text based adventure Mishmaccles 2 2,745 Jul-07-2021, 05:00 PM
Last Post: BashBedlam
  Text Adventure Module Leroyrobenson 1 2,284 Feb-23-2020, 09:57 PM
Last Post: Larz60+
  Adding persistent multiple levels to game michael1789 2 2,485 Nov-16-2019, 01:15 AM
Last Post: michael1789
  Using classes for room movement (text game) Lawr3y 3 6,671 Aug-20-2019, 12:40 AM
Last Post: Lawr3y
  [pygame] Inventory items not working SheeppOSU 14 7,029 May-27-2019, 09:44 PM
Last Post: metulburr
  [pygame] Inventory problems. Weapons equipped to wrong slot SheeppOSU 6 4,139 May-07-2019, 02:46 AM
Last Post: SheeppOSU
  Adding a single player mode to my wxOthello game keames 29 12,376 May-01-2019, 02:56 AM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020