Python 将玩家移动到特定房间
我有一个冒险游戏,我正在为初学者创建。我唯一真正的问题是,如果他们没有一个项目,它仍然可以让他们前进 你在杂草丛中,你需要一杯苏打水才能前进。我设下陷阱并告诉玩家,所以我想我可以直接把他们送到他们需要的物品所在的房间 代码: 输出:Python 将玩家移动到特定房间,python,Python,我有一个冒险游戏,我正在为初学者创建。我唯一真正的问题是,如果他们没有一个项目,它仍然可以让他们前进 你在杂草丛中,你需要一杯苏打水才能前进。我设下陷阱并告诉玩家,所以我想我可以直接把他们送到他们需要的物品所在的房间 代码: 输出: 你在第二周。 你在清除杂草方面做得很好,但是。。。 你需要从小吃棚里拿一杯苏打水来继续前进 你在{'name':'snakt shack','North':'Tulip saccurance','East':警卫室','item':'soda','count':2}
你在第二周。
你在清除杂草方面做得很好,但是。。。
你需要从小吃棚里拿一杯苏打水来继续前进
你在{'name':'snakt shack','North':'Tulip saccurance','East':警卫室','item':'soda','count':2}
你没有找到
你会在某个时候需要它,把它捡起来?(是/否)
期待这个-你在{'name':'snakt shack','North':'Tulip sactionary','East':警卫室,'item':'soda','count':2}
你没有找到
也就是说,你在小吃棚里
你找到苏打水了吗
代码在哪里?@Barmar我刚刚提交了一个编辑,使代码更加清晰。当前的房间['name']=房间['snakt shack']
应该是当前的房间=房间['snakt shack']
@Barmar-谢谢第一篇帖子,我想它已经发布得很清楚了。@Barmar谢谢,简单的东西,总是。。。当当
'soda' not in inventory:
print("You did a great job clearing the weeds, but...")
print("You need a soda from the Snack shack to move forward")
#send player to Snack shack
current_room['name'] = rooms['Snack shack'] #current_room is variable used to move players
print("You are in the {}".format(current_room['name']))
print("You found {}".format(current_room['item']))
I = input("You will need it at some point, pick it up? (Y/N)")
if I == 'Y':
inventory.append(current_room['item'])
print("Your current inventory is:", inventory)
print('You are in {}.'.format(current_room['name']))