CodeCombat - Desert Combat[SOLVED]

Could somebody please help me with this level? My guy won’t move down, and I don’t know what’s wrong!

My code:

# while-loops repeat until the condition is false.

ordersGiven = 0
while ordersGiven < 5:
    # Move down 10 meters.
    yPos = hero.pos.y - 10
    # 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()
    # When you're done giving orders, join the attack.
    if enemy:
        hero.attack(enemy)

Thank you in advance.

It’s because you aren’t using a moveXY statement. You define yPos, but don’t use it anywhere. You want to move to (hero.pos.x, yPos).

Thank you @abc! It worked!

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