Re: PyAudioGame Help, Cash error

Not all that familiar with PyAudioGame, but it seems like the "cash" attribute isn't implemented. Here's a few tweaks that might help:

#ATTACK!!!
import pyaudiogame
spk = pyaudiogame.speak
MyApp = pyaudiogame.App("My Application")

#Lets create a storage box so we can put our dragon's hp in there
dragon_hp = 100

#Now lets make our hero's hit strength
hero_hit = 10

#An attack function
def attack():
    #When the hero attacks he takes the dragon's hp
    dragon_hp = dragon_hp - hero_hit

#Now lets make a way for our hero to attack
def logic(actions):
    key = actions['key']
    if key == "space" and dragon_hp > 0:
        attack()
        spk("You, the hero of our tale swing your sword. You hit the dragon for %s damage! Now our poor dragon has %s hp left" % (hero_hit, dragon_hp))
        if dragon_hp <= 0:
            spk("You, the hero of our story killed the dragon. The whole town thanks you!")
            spk("Press escape to go back home")

MyApp.logic = logic
MyApp.run()

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector

Reply via email to