Desert combat - Is this a bug


#1

this is my code

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)


#2

every time i run it the soldiers body ram me


#3

image


#4

Please format your code according to the FAQ.


#5

@Kevin_Yu
u did not increment the ordersGiven variable each time you repeat.
i don’t know why the system didn’t tell you you have an infinite loop.