Desert combat - Is this a bug


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.

# Be sure to increment ordersGiven!

while True:
enemy = hero.findNearestEnemy()
# When you’re done giving orders, join the attack.


every time i run it the soldiers body ram me




Please format your code according to the FAQ.


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.