Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

[Solved] "Backwoods Standoff"


Hello fellow code combatants,

I’m using Python, and have reached the Backwoods Standoff level. After several unsuccessful tries I present the unknown problem to you. :slightly_frowning_face:

Thank you in advance.

Here is my code:

while True:
enemy = hero.findNearestEnemy()
# Use an if-statement with isReady to check “cleave”:
if enemy:

    # Cleave!
    ready = hero.isReady("cleave")
# Else, if cleave is not ready:

    # Attack the nearest ogre!


Carefully read the comments -

This is the proper format for cleave:

if enemy:
    if hero.isReady("cleave"):

Memorize it. You’re going to be seeing this A LOT!


@MunkeyShynes Thank you for replying so promptly!

I used your suggestion. Cleave works, and my character runs to the enemy, but unless cleave is ready, does no harm to them.

How come my hero.attack(enemy) doesn’t work, do you know?



Can you post a screenshot of your code? It sounds like the else statement isn’t tabbed over properly. It’s probably a structure problem.



I’ve tried moving hero.cleave(enemy) down for spaces, as another post suggests, but that didn’t work.



That’s what I thought. The else statement should line up under the if hero.isReady statement.