Skip to content

Instantly share code, notes, and snippets.

@XxTUBBYNINJAxX
Created March 2, 2013 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XxTUBBYNINJAxX/5072535 to your computer and use it in GitHub Desktop.
Save XxTUBBYNINJAxX/5072535 to your computer and use it in GitHub Desktop.
import time
import random
run = random.randrange(1,4)
fighting = "no"
health = 30
att = random.randrange(5,15)
spd = random.randrange(5,10)
print "you see a monster"
fighting = "yes"
mon1hp = 10
mon1att = random.randrange(5,10)
mon1spd = 11
if fighting == "yes":
if mon1spd >= spd:
while True:
if health <= 0:
print "You have died"
time.sleep(6)
exit(1)
if mon1hp <= 0:
print "You killed it"
fighting == "no"
break
print "He attacks"
time.sleep(2)
health = health - mon1att
print "He did " + str(mon1att), " damage"
time.sleep(2)
print "Your health is: " + str(health)
mon1att = random.randrange(5,10)
print "Will you:"
print "(attack)"
print "(run) away"
action1 = raw_input('> ')
if action1 == "run":
if run <= 2:
print "cant get away"
run = random.randrange(1,4)
if run >= 3:
print "you got away"
run = random.randrange(1,4)
fighting = "no"
time.sleep(2)
break
if action1 == "attack":
print "you hit him"
time.sleep(2)
mon1hp = mon1hp - att
print "you did " + str(att), " of damage"
time.sleep(2)
print "his health is " + str(mon1hp)
att = random.randrange(5,15)
if mon1spd <= spd:
#same thing but "player attacks first"
if fighting == "no":
print "Done"
time.sleep(6)
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment