所以基本上,我正在用python制作一个文本冒险游戏,目标是根据线索和谜语在房子的某个地方找到奖品。当你进入一个房间,告诉程序你想去北,南,东面或西面,它会给你一个房间的描述,但在某些情况下,当你进入一个房间时,除了你刚从那里来的房间,没有别的地方可以去,所以我想把它变成一个不同的输出,如果你已经进入了一个房间。我该怎么做?

class bc:

HEADER = '\033[95m'

OKBLUE = '\033[94m'

OKGREEN = '\033[92m'

WARNING = '\033[93m'

FAIL = '\033[91m'

ENDC = '\033[0m'

BOLD = '\033[1m'

UNDERLINE = '\033[4m'

inventory = []

chest = "Chest"

key = "Key"

book = "Book"

picture = "Picture"

def playGame():

location = "Porch"

show_intro()

while not (location == "Exit"):

showRoom(location)

direction = str(input(bc.BOLD + bc.HEADER + "Which direction

do you want to go?: \n" + bc.ENDC))

location = pickRoom(direction, location)

def show_intro():

print(bc.BOLD + """Welcome to a game with no graphics so you get

more FPS's!

Old man Mesarosh lived here years ago before he and his wife suddenly

disappeared.

Before he died, it was said that he left behind a chest full of

treasure.

It's your job to figure out where he left it, and fast...

Police drive by every 30 minutes searching for teens exploring the

abandoned house

Find the clues left behind by Mesarosh and find where the treasure is

hidden.

Type "North", "South", "East" or "West" to decide which way to go.

Good luck! \n""" + bc.ENDC)

def pickRoom(direction, room):

while True:

if(direction == "quit") or (direction == "exit"):

print("Better luck next time!")

return "Exit"

elif room == "Porch":

if direction.lower() == "north":

return "Pantry"

elif room == "Pantry":

if direction.lower() == "north":

return "Kitchen"

elif direction.lower() == "east":

return "DiningRoom"

elif room == "DiningRoom":

if direction.lower() == "west":

return "Pantry"

elif room == "Kitchen":

if direction.lower() == "west":

return "LivingRoom"

elif direction.lower() == "east":

return "Bedroom"

elif room == "Bedroom":

if direction.lower() == "west":

return "Kitchen"

elif room == "LivingRoom":

if direction.lower() == "west":

return "Bathroom"

elif direction.lower() == "north":

return "Stairs"

elif room == "Bathroom":

if direction.lower() == "east":

return "LivingRoom"

elif room == "Stairs":

if direction.lower() == "south":

return "Bar"

elif room == "Bar":

if direction.lower() == "east":

return "Shop"

elif room == "Shop":

if direction.lower() == "north":

return "Closet"

elif direction.lower() == "south":

return "Storage"

elif room == "Storage":

if direction.lower() == "north":

return "Shop"

elif room == "Closet":

if direction.lower() == "south":

return "Shop"

def showRoom(room):

if room == "Porch": #Done

showPorch()

elif room == "Pantry": #Done

showPantry()

elif room == "Kitchen": #Done

showKitchen()

elif room == "DiningRoom": #Done

showDining()

elif room == "Bedroom": #Done

showBedroom()

elif room == "LivingRoom": #Done

showLiving()

elif room == "Bathroom": #Done

showBathroom()

elif room == "Stairs": #Done

showStairs()

elif room == "Bar": #Done

showBar()

elif room == "Shop": #Done

showShop()

elif room == "Storage": #Done

showStorage()

elif room == "Closet": #Done

showCloset()

playGame()

python游戏房间_Python House冒险-如果已经进入一个房间,如何给出不同的输出相关推荐

  1. python 游戏开发_Python游戏开发入门

    spContent=--玩游戏的最高境界是什么? --当然是设计一款属于自己的游戏! --设计游戏不是目的,从游戏看道理,从道理看人生,人生何尝不是属于自己的游戏? --"弹指之间·享受创新 ...

  2. python 游戏扫雷_Python游戏:扫雷

    原标题:Python游戏:扫雷 本文代码基于 python3.6 和 pygame1.9.4. 这次,我们来模仿做一个 XP 上的扫雷,感觉 XP 上的样式比 win7 上的好看多了. 原谅我手残,扫 ...

  3. python虚拟人脸生成_GitHub - 597111463/seeprettyface-generator-yellow: 这是一个用StyleGAN训练出的黄种人人脸生成器...

    黄种人人脸生成器 注明:之前做的一些有意思的人脸生成器,现在全部开源分享出来.它的主要作用是可生成制作各类型的人脸素材,供我们任意使用且无须担心人脸版权的问题.在定制人脸上,开源的全系列生成器包括:黄 ...

  4. python游戏开发框架_Python游戏开发:数字华容道

    今年年初,新一季的<最强大脑>开播了,第一集选拔的时候大家做了一个数字游戏,名叫<数字华容道>,当时何猷君以二十几秒的成绩夺得该项目的冠军,看了这个游戏之后我决定要写一个< ...

  5. python游戏设计_Python设计一个猜大小游戏

    Python设计小游戏实例 本文主要介绍如何用Python设计一个经典小游戏:猜大小. 在这个游戏中,将用到前面我介绍过的所有内容:变量的使用.参数传递.函数设计.条件控制和循环等,做个整体的总结和复 ...

  6. python游戏后端_Python实现生命游戏

    1. 生命游戏是什么 生命游戏是英国数学家约翰·何顿·康威在1970年发明的细胞自动机.它包括一个二维矩形世界,这个世界中的每个方格居住着一个活着的或死了的细胞.一个细胞在下一个时刻生死取决于相邻八个 ...

  7. python 游戏开发框架_Python开发 基于python实现坦克大战游戏

    这篇文章主要为大家详细介绍了基于python实现坦克大战游戏,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 本文实例为大家分享了python实现坦克大战游戏的具体代码, ...

  8. python游戏设计_python小游戏设计入门1-了解游戏

    从小到大玩过很多的游戏,在我小时候,能玩游戏的地方不多,那时玩游戏都是偷摸玩的,只要是个游戏就觉得非常有趣,比较经典的有魂斗罗,拳皇,超级玛丽,贪吃蛇,俄罗斯方块等游戏:发展到现在,玩游戏已经成为生活 ...

  9. python交换函数_python a,b = b,一个实现?它与C ++交换函数有何不同?

    当我想尝试以下版本的python版本时遇到了这个问题:https : //leetcode.com/problems/first-missing- positive/discuss/17071/My- ...

最新文章

  1. 在ASP.NET中使用Office Web Components (OWC)创建统计图
  2. 针对MySQL数据库主从延迟的问题
  3. lwip接收文件 stm32_接收数据
  4. C++入门课程系列:基础知识篇(1)
  5. 监督学习—最小二乘法
  6. 施一公:如何提高英文的科研写作能力
  7. 将excel文档转为word文档的方法
  8. 微信HOOK之二叉树获取信息 201-12-25
  9. 安卓源码下载的环境搭建
  10. S7-200SMART PLC与V20变频器MODBUS通讯示例程序
  11. SAP ABAP STANDARD TABLE,SORTED TABLE和HASHED TABLE简介
  12. 列表推导式[x for x in range(n)]
  13. 软件工程——2021软科中国大学专业排名
  14. 语句摘抄——第10周
  15. Android中百度地图基础实现,定位
  16. 根号分治 + 入门题目
  17. 边学边赚,未来是否存在一份边学习边赚钱的工作?构建一个诞生未来职业的“种植果园”...
  18. 软件工程小分队第一次会议
  19. python-爬虫:获取163邮箱的收件箱信息列表
  20. 迁移gogs直接拷贝其gogs-repositories导致hook脚本中的相关路径与实际不相符

热门文章

  1. 拿来即用的 Python 时间范围判断方法
  2. 中国内镜超声针市场趋势报告、技术动态创新及市场预测
  3. 如何通过索引说数据库优化能力
  4. 从零入门 Serverless | 使用 Spot 低成本运行 Job 任务
  5. tensorflow 版本列表_最新|谷歌发布TensorFlow 1.3.0版本,都更新了哪些内容?
  6. 华为:今年至少 3 亿台设备使用鸿蒙;增长 7%,互联网人薪资报告出炉;英特尔侵犯芯片专利被判赔偿 22 亿美元 | 极客头条...
  7. HarmonyOS 2.0:正式开源,年底面向开发者发布智能手机 Beta 版本
  8. 趣讲 PowerJob 超强大的调度层,开始表演真正的技术了
  9. 第一个国产Apache 顶级项目 Kylin,了解一下!| 原力计划
  10. 清华学霸组团的工业 AIoT 创企再获数千万融资:玩家应推动在边缘 AI 芯片上跑算法...