Arcane Ally Level - Wrong Code?

Hello Everyone! I am stuck in this level… I really don´t know what´s my code´s problem here:

I would really apreciate any help ^^
Thanks!

It’s best to get in the habit of checking to see if there is an enemy first, before cleaving or attacking, because if there is a moment of time when no enemy is present, the code fails.

I think that´s not the problem… check out the “fix code” message:

But thanks to replying ^^

Oh wait, I kinda got it… but how could I write it correctly?

what I said before is exactly the problem and that’s what the null means - there is no enemy. You just need to put

if enemy:

after the variable enemy that you have defined and tab everything after it over.

Summary
if enemy:
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    else:
        hero.attack(enemy)

Memorize this because you’re going to be doing it a LOT.

3 Likes

Oh, sorry :sweat_smile:, now I really got it! :
I really apeciate your answer :slight_smile:
I don´t understand 100% of english but i´m trying to

What language do you know?

1 Like

He’s using python (20 char)

I mean language as in english spanish and ect. :sweat_smile: My bad I didn’t describe.