您好,欢迎访问一九零五行业门户网

python实现的简单RPG游戏流程实例

本文实例讲述了python实现的简单rpg游戏流程。分享给大家供大家参考。具体如下:
#rpgrpg = truewhp = 100mahp = 100hhp = 100mhp = 10def dgrnd () : wa = raw_input (what does warrior do?) ma = raw_input (what does mage do?) ha = raw_input (what does healer do?) if wa == flame slash : print (warrior uses flame slash!) mhp-20 elif wa == dragon slash and m == dragon : print (warrior used dragon slash!) mhp-80 if wa == dragon and m == troll or m == goblin : print (warrior's attack did no damage!) if ma == icicle drop : print (mage used icicle drop) mhp-15 mahp-10 whp-10 hhp-10 if ma == flames of heck : mhp-75 mahp-50 wph-50 hhp-50 if ha == heal warrior : print (healer heals warrior!) whp + 20 if ha == heal mage : print (healer heals mage!) mahp + 20 if ha == heal healer : print (healer heals healer!) hhp + 20 if ha == attack : print (healer attacks!) mhp - 5 print (m+attacks!) if m == dragon : whp - 40 mahp - 40 hhp - 40 if m == troll : whp - 30 mahp - 30 hhp - 30 if m == goblin : whp - 20 mahp - 20 hhp -20 print (warrior has +whp+ hp left, mage has +mahp+ hp left, and healer has +hhp+ hp left!) if mhp == 0 : print (you defeated the +m+ !) print (that is all i have built so far. eventually, there will be more!) print (thank you for playing!!) dgrnd ()if rpg == true : print (this mode is not yet complete. it only contains a dungeon so far. i'm still working on the rest.)#dungeon whp = 100 mahp = 100 hhp = 100 mhp = 10 m = fail print (you enter the dungeon) rm = raw_input (there are three passages. do you take the first one, the second one, or the third one?) if rm == 'one' : m = 'troll' mhp = 80 print (a +m+ appears!) if rm == 'two' : m = 'goblin' mhp = 35 print (a +m+ appears!) if rm == 'three' : m = 'dragon' mhp = 120 print (a +m+ appears!) while mhp > 0 : dgrnd ()
希望本文所述对大家的python程序设计有所帮助。
其它类似信息

推荐信息