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 = friend.findNearestEnemy()
if enemy == friend.findNearestEnemy():
friend.command(friend, “attack”, enemy)
# Command to move east by small steps.
else:
friend.command(friend, “move”, (“x”: friend.pos.x +1 “y”: friend.pos.y))
Pls format your code pls?
Here is the formatted the code
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 = friend.findNearestEnemy()
if enemy == friend.findNearestEnemy():
friend.command(friend, “attack”, enemy)
# Command to move east by small steps.
else:
friend.command(friend, “move”, (“x”: friend.pos.x +1 “y”: friend.pos.y))
i do not know how plz tell me how
Screenshot pls???
20 chars
@Leonardo_White I found the problem
Why is the friend commanding the friend?
Yes that is the problem.
It should be:
hero.command(friend, “attack”, enemy)
and
hero.command(friend, “move”, (“x”: friend.pos.x +1 “y”: friend.pos.y))
this works better
hero.command(friend, “move”, {“x”: friend.pos.x +1 “y”: friend.pos.y})
True, But they both work
@Leonardo_White I think the solution is here
You need a comma after friend.pos.x + 1
Remove the " " from the x and the y
@Leonardo_White
These can help you
OK, type what the error is
The format for the position argument for the move command is {“x”: x-coordinate, “y”: y-coordinate}
Under the large text for the error, it says the program is expecting a certain character, but is finding a different one. This is because there is no comma separating x and y.



