# 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.
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!