or @Deadpool198 what about you?
Sure…pls post a fresh copy of your code. And you are right about the indent…looking at the pick, it was not obvious that the last line wrapped…it looked like an indent.
# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
while True:
friends = hero.findFriends()
# Use for-loop and for each friend:
for friend in friends:
# If they see an enemy then command to attack.
if enemy = friend.findNearestEnemy():
hero.command(friend, "attack", enemy)
# Command to move east by small steps.
else:
hero.command(friend, "move", {“x”: friend.pos.x + 1, “y”: friend.pos.y})
Try to put this before the if statement and only check if enemy.
Andrei
ok so my troops are moving but they just keep going to the left
and dont attack at all
Can I see the code?
Andrei
# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
while True:
friends = hero.findFriends()
# Use for-loop and for each friend:
for friend in friends:
# If they see an enemy then command to attack.
enemy = hero.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
# Command to move east by small steps.
else:
hero.command(friend, "move", {"x": friend.pos.x + 1, "y": friend.pos.y})
and its a little laggy
Here put friend instead of hero.
Andrei
Just put instead of 1 a lower number (like 0.27).
Andrei
how do you blur something out? like you did?
im confused on that but, on the bright side i got the bonus!!!
No. I will explain that to you in a PM. And congratulations for completing the level and the bonus!
Andrei
ok and thanks! and thanks to you to @dedreous
Andrei, be sure to cover the ‘badge’ too
quick question, why does a text like this need to be 20 characters?
To prevent people from spamming.
Andrei