[Solved] Operation killdeer help***

I did this level before and got it on a different campaign but doing the level again I can not get it to work here’s 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

while True:
    # Move to the X only if shouldRun() returns True
    run = shouldRun()
if run:
    hero.moveXY(75, 37)
    # Else, attack!
else:
    hero.attack(enemy)

Put these in the while loop.

1 Like

huh I have it in the code already I copied the code in there all of it

what I put before was trying to figure out where to put the enemy = hero.find nearest enemy

I completed the level

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.