[Tutor] Python - RPG Combat System

Alan Gauld alan.gauld at btinternet.com
Sun Aug 1 02:20:31 CEST 2010


"Jason MacFiggen" <jmacfiggen at gmail.com> wrote

> and also, what can I do instead of writing print so many times?

Learn about format strings and use triple quoted strings.


>        else:
>            print "Menu Selections: "
>            print "1 - Attack"
>            print "2 - Defend"
>            print

menu1 = """
Menu Selections
1 - Attack
2 - Defend
"""

else:
    print menu1

>        if choice == 1:
>            mo_hp = mo_hp - my_dmg
>            print "The Lich King is at ", mo_hp, "Hit Points"
>            print "You did ", my_dmg, "damage!"
>            print

        if choice == 1:
            mo_hp = mo_hp - my_dmg
            print "The Lich King is at %s Hit Points\nYou did %s 
damage\n" % (mo_hp, my_dmg)

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list