Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Single User Dungeon
#2
Okay, you have the items in your room lists. First thing you want to do is show them to the user. In the print_message function, I would print out the items in the room. Something like:

print('You see the following items:', ', '.join(room[1]))
Then, in the get_player_choice function, allow them to get or drop items. Change the input text to "What do you want to do?". You're going to need a player inventory. This would work as another list, that you pass to the various functions. So, the player would enter something like 'get paintings'. You can parse that into the command (get) and the parameter (paintings). I find the partition method of strings to be good for that. Then check that the thing they want is in the room (with the in operator on the room's contents). If it is, remove it from room's contents and append it to the player's inventory. Dropping the item would work the same, but in reverse.

Check out the text adventure tutorial link in my signature. It has an example of a system just like that, only using dictionaries instead of lists.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Single User Dungeon - by tckay - Apr-30-2017, 06:13 PM
RE: Single User Dungeon - by ichabod801 - Apr-30-2017, 09:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Single User Dungeon kython 2 4,223 Mar-01-2017, 11:00 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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