I need help on backwoods brawl

plz help im stuck on this code

while True:

hero.moveXY(60, 51)
enemy = hero.findNearestEnemy()
if enemy:
    hero.attack(enemy)

i die around here v

                         v
else:
    hero.health
    enemy = hero.findNearestEnemy()
if enemy:
    hero.attack(enemy)
    hero.cleave(enemy)

Screenshot 2021-01-29 at 11.44.48 AM Screenshot 2021-01-29 at 11.44.38 AM

1 Like

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!

What if the hero isn’t ready

else. hero move(x.y.)

1 Like

Welcome‌ ‌welcome‌ ‌to‌ ‌the‌ ‌forum!‌ ‌It‌ ‌is‌ ‌a‌ ‌lovely‌ ‌place‌ ‌where‌ ‌you‌ ‌can‌ ‌share‌ ‌all‌ ‌kinds‌ ‌of‌ stuff‌ ‌(appropriate‌ ‌of‌ ‌course),‌ ‌share‌ ‌bugs,‌ ‌and‌ ‌even‌ ‌get‌ ‌assistance‌ ‌for‌ ‌code!‌ ‌We‌ ‌suggest‌ ‌that‌ ‌you‌ ‌review‌ ‌this‌‌ topic‌ ‌which‌ ‌shows‌ ‌all‌ ‌essentials‌ ‌of‌ ‌this‌ ‌board!‌ ‌And‌ ‌we‌ ‌suggest‌ ‌you‌ ‌review‌ this topic‌ ‌which‌ ‌shows‌ ‌how‌ ‌to‌ ‌post‌ ‌your‌ ‌code‌ ‌correctly!‌ ‌Thanks!!‌ ‌ :partying_face: :partying_face:

What are you trying to do here? Your else should be after your ifs and your second if should be an elif. I don’t get what you are trying to do in your else statement.

You need to check first if your hero can cleave, then cleave.

What are you trying to use here?

You can delete this since you already defined enemy
and this

Since it is just a repeat of this

Lydia

And please show your equipment
Lydia

and what level in that brawl are you. Also tell us how and when your hero dies.

ok thank you for sovling it

3 Likes

congrats on passing the level
though I dont think you need to welcome yourself lol :grin:

No problem!
Lydia
20 chara

Also happy Birthday @Michael_Summers

1 Like
Thannk you

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