国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python實(shí)現(xiàn)的簡(jiǎn)單RPG游戲流程實(shí)例

2020-01-04 18:06:18
字體:
供稿:網(wǎng)友

這篇文章主要介紹了python實(shí)現(xiàn)的簡(jiǎn)單RPG游戲流程,實(shí)例分析了Python實(shí)現(xiàn)RPG游戲流程的常用判定技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了python實(shí)現(xiàn)的簡(jiǎn)單RPG游戲流程。分享給大家供大家參考。具體如下:

 

 
  1. #RPG 
  2. rpg = True 
  3. whp = 100 
  4. mahp = 100 
  5. hhp = 100 
  6. MHP = 10 
  7. def dgrnd () : 
  8. wa = raw_input ("What does Warrior do?"
  9. ma = raw_input ("What does Mage do?"
  10. ha = raw_input ("What does Healer do?"
  11. if wa == "flame slash" : 
  12. print ("Warrior uses Flame Slash!"
  13. MHP-20 
  14. elif wa == "Dragon Slash" and M == "Dragon" : 
  15. print ("Warrior used Dragon Slash!"
  16. MHP-80 
  17. if wa == "Dragon" and M == "Troll" or M == "Goblin" : 
  18. print ("Warrior's attack did no damage!"
  19. if ma == "icicle drop" : 
  20. print ("Mage used Icicle Drop"
  21. MHP-15 
  22. mahp-10 
  23. whp-10 
  24. hhp-10 
  25. if ma == "flames of heck" : 
  26. MHP-75 
  27. mahp-50 
  28. wph-50 
  29. hhp-50 
  30. if ha == "heal warrior" : 
  31. print ("Healer Heals Warrior!"
  32. whp + 20 
  33. if ha == "heal mage" : 
  34. print ("Healer Heals Mage!"
  35. mahp + 20 
  36. if ha == "heal healer" : 
  37. print ("Healer Heals Healer!"
  38. hhp + 20 
  39. if ha == "attack" : 
  40. print ("Healer Attacks!"
  41. MHP - 5 
  42. print (M+"attacks!"
  43. if M == "dragon" : 
  44. whp - 40 
  45. mahp - 40 
  46. hhp - 40 
  47. if M == "Troll" : 
  48. whp - 30 
  49. mahp - 30 
  50. hhp - 30 
  51. if M == "Goblin" : 
  52. whp - 20 
  53. mahp - 20 
  54. hhp -20 
  55. print ("Warrior has "+whp+" HP left, Mage has "+mahp+" HP left, and Healer has "+hhp+" HP left!"
  56. if MHP == 0 : 
  57. print ("You defeated the "+M+" !"
  58. print ("That is all I have built so far. Eventually, there will be more!"
  59. print ("Thank You for Playing!!"
  60. dgrnd () 
  61. if rpg == True : 
  62. print ("This mode is not yet complete. It only contains a dungeon so far. I'm still working on the rest."
  63. #Dungeon 
  64. whp = 100 
  65. mahp = 100 
  66. hhp = 100 
  67. MHP = 10 
  68. M = "fail" 
  69. print ("You enter the dungeon"
  70. rm = raw_input ("There are three passages. Do you take the first one, the second one, or the third one?"
  71. if rm == 'one' : 
  72. M = 'Troll' 
  73. MHP = 80 
  74. print ("A "+M+" appears!"
  75. if rm == 'two' : 
  76. M = 'Goblin' 
  77. MHP = 35 
  78. print ("A "+M+" appears!"
  79. if rm == 'three' : 
  80. M = 'Dragon' 
  81. MHP = 120 
  82. print ("A "+M+" appears!"
  83. while MHP > 0 : 
  84. dgrnd () 

希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄯善县| 宁远县| 佛冈县| 吉首市| 潞城市| 兴隆县| 大新县| 浦东新区| 丰宁| 台州市| 保山市| 张家口市| 平远县| 苍南县| 桐庐县| 封丘县| 宜丰县| 定兴县| 黄龙县| 青海省| 米易县| 托克托县| 隆昌县| 朝阳区| 紫阳县| 铁岭县| 肃南| 临沧市| 白城市| 天长市| 盐源县| 广南县| 荆州市| 鄄城县| 金川县| 金乡县| 吴江市| 阿拉善盟| 无棣县| 古蔺县| 松潘县|