# while-loops repeat until the condition is false. ordersGiven = 0 while ordersGiven < 5: # Move down 10 meters. hero.moveXY(hero.pos.x, 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! hero.say("ordersGiven") while True: enemy = hero.findNearestEnemy() # When you're done giving orders, join the attack. hero.attack(enemy)
This is my code and I don’t understand what happened. The point of this is to move down red Xes and say a message. On the 3rd X my player moves to the right. My code: hero.moveXY(hero.pos.x, hero.pos.y - 10). There is no change in my X so why does it move to the right?