Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Help on Desert Combat

# while-loops repeat until the condition is false.

ordersGiven = 0
while ordersGiven < 5:
    # Move down 10 meters.
    hero.pos.y -= 10
    hero.moveXY(hero.pos.x, hero.pos.y)
    # Order your ally to "Attack!" with hero.say
    # They can only hear you if you are on the X.
    hero.say("Attack!")

    # Be sure to increment ordersGiven!
    ordersGiven += 1

while True:
    enemy = hero.findNearestEnemy()
    enemy == "brawler"
    # When you're done giving orders, join the attack.
    if enemy:
        hero.attack(enemy)
        if hero.isReady("cleave"):
            hero.cleave(enemy)

My hero just stands there and won’t move.
Please help.

Delete this line:

and edit this line, adding - 10 after the .y:

Also, delete this line:

1 Like

Thanks! It worked. 20 characters.

2 Likes

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