[Tutor] Running RPG game again.

. , administrata at hotmail.com
Sat May 21 11:58:15 CEST 2005


Hi,

I'm trying to make the RPG game to be able to run again.

But, when I type "run", nothing happens.

thanks.

-------------------------------------------------------------------------------------------------------------------------------------------
import random

print \
      """
      Warrior - damage: 10~60
      Archer - damage: 0~100
      HP of Player: 100
      HP of the monster: 300"""

wp = raw_input("\n\nSelect between warrior and archer: ")

mob = 300
hit = 0
hp = 100
dmg = 0
atk = 0
run = ""

while True:
    while (mob > 0):
        hit += 1
        mob = mob - dmg
        hp = hp - atk

        if wp == "warrior":
            dmg = random.randrange(50) + 10
            atk = random.randrange(10)

        elif wp == "archer":
            dmg = random.randrange(100)
            atk = random.randrange(5)

        else:
            print "\nError"

        print "\n", hit, "hits"
        print "HP of", wp,":", hp,"/100"
        print "HP of the monster:", mob,"/300"

        print "\nYou defeated the monster by", hit,"hits,", dmg,"damage"


    run = raw_input("\nrun or exit ")
    if run == "run":
        continue
    else:
        break
-------------------------------------------------------------------------------------------------------------------------------------------

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



More information about the Tutor mailing list