Python: Making my adventure game code, begin to "do something." -


absolute beginner here. making text adventure game sharpen beginner skills. can give me example of go in "def firstbattle", function?

something small example of battle, , updating stats , inventory? thanks

    def displayintro():         # update think of more add         print(""" lord deadra. have been sent citiel               overthrow current king navator. throughout               travels, encounter various enemies of               types. luck. """)       def displayinventory():     # keeps list of stuff in dictionary. because returned      # stuff, can use function in other functions update         print("inventory:")         stuff = {"health potions": 5,                  "poison": 5,                  "stamina potions": 5,                  "go crazy potion": 5,                  "arrows": 50,                  "hunting bow": 1,                  "hunting knife": 1,                  "big sword": 1,                  "magic shield": 1}          return stuff       def displaystats():     # displays initial health stats         print()         print("stats:")         health = 100         stamina = 100         confidence = 100          return "health:",health, "stamina:",stamina, "confidence:",confidence       def firstbattle():     # first encounter enemy. after battle, update inventory     # , health stats 

you need damage variable. implement enemydamage, enemyhealth , yourdamage variable.

def battlescene():     print("enter attack.")     input()     health = health - enemydamage     enemyhealth = enemyhealth - yourdamage     stamina = stamina - # ever number want stamina go down     print("your hp: " + health)     print("enemy hp: " + enemyhealth) 

to implement weapons change damage values using class block.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -