This is my code.
# Lure the ogres into a trap. These ogres are careful.
# They will only follow if the hero is injured.
# This function checks the hero's health
# and returns a Boolean value.
def shouldRun():
if hero.health < hero.maxHealth / 2:
return True
else:
return False
enemy = hero.findNearestEnemy()
run = shouldRun()
while True:
# Move to the X only if shouldRun() returns True
if run == True:
hero.moveXY(75, 37)
# Else, attack!
else:
hero.attack(enemy)
I’ve read multiple topics for this one. It just makes me even more confused and I cannot get Alejandro to stop standing in one place after he says “…but it’s dead.” after he kills an ogre.
I’m stumped and I’ve no clue what to do.