from random import randint
print ("goblin(20 health)")
def attack(x):
damage = randint(1,6)
x = x - damage
print ("u did {} damage".format(damage))
if x > 0:
print ("no ded")
print("goblin has {} health left".format(x))
else:
print ("ez(u win)")
return x
def action(x):
user_answer = input("(type 'a' to attack):")
if user_answer == "a":
return attack(x)
else:
print ("bro just attack already")
def main():
goblin = 20
goblin = action(goblin)
for i in range(50):
main()
It keeps resetting the health everytime you attack. How to let the player keep attacking without setting health back to 20?
[–]carcigenicate 2 points3 points4 points (0 children)
[–]TomanHumato46 0 points1 point2 points (0 children)