Help with Desert Combat

ordersGiven = 0
while ordersGiven < 5:
x = hero.pos.x
y = hero.pos.y - 10
hero.moveXY(x, y)
hero.say(“Attack!”)
ordersGiven += 1;
if (ordersGiven >= 5):
break;
hero.moveXY(48, 31)
while True:
enemy = hero.findNearestEnemy()
hero.attack(enemy)

1 Like

So basically My hero is attacking but the hero can’t survive. What do I need to do cause I’ve been stuck on this level for awhile.

Hello, @Kyilan_Davis-Kramer and welcome to the discourse! If you haven’t yet, please read the rules page here: Welcome to CodeCombat Discourse Forums!
Also, please format your code using the “preformatted text” option
If you could provide us a screenshot of your hero’s items as well, that’d be swell

1 Like

Your code is correct, but I think your gear might be inadequate
you probably need around ~1000 health and maybe 50 dps to do it?
I recommend buying as high tier gear as possible, as you can’t sell gear you don’t want

1 Like

oh just worked thank you and thanks for welcoming sorry I didn’t reply yesterday I got out of school once you responded so

1 Like

You’re welcome :heart:
Glad I could help!

1 Like

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