import random
import time
def fighting():
def fight():
print 'You take a swing at the Knight'
time.sleep(2)
for i in range(1):
random.random()
if i > .5:
print 'Direct Hit!'
else:
print 'He parries!'
swing = raw_input("> ")
if swing.lower() in {"swing"}:
fight()
fighting()
Hi, I'm trying to implement some sort of health system into my game in Python. This is a small excerpt, but it's what the whole (extremely simple) fighting system is based off of. Basically I want it so that if your swing hits four times that it reads with a message that you've won. The major problem is that I'm an extremely novice programmer, and it was basically a miracle that I got this to work. I have no idea how to implement my plan further than this and I could really use some pointers and help. I was thinking a loop of some sort, but I don't know how you'd do that. Anyways, Please help! Thank you!
Aucun commentaire:
Enregistrer un commentaire