Help with level backwoods-standoff-a

CodeCombat - Coding games to learn Python and JavaScript?
Why is this code incomplete?

Munchkins are attacking!

The swarms will come at regular intervals.

Whenever you can, cleave to clear the mass of enemies.

while True:
# Use an if-statement with isReady to check “cleave”:
if hero.isReady(“cleave”):
# Cleave!
hero.cleave()
# Else, if cleave is not ready:
else:
enemy = hero.findNearestEnemy()
# Attack the nearest ogre.
hero.attack(enemy)

Welcome Kkoder!

Do you have the
while True: Formatted and the else: formatted?

You need this for the code to read itself.

Welcome to the discourse @kkoder ! Please consider formatting your code the next time you post it using this button:

As for your problem:

this takes in a parameter, so it should look more like:

hero.cleave("enemy")

1 Like