Dec-17-2019, 03:07 AM
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:
Thanks,
detkitten
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