It wont work please help
{
var friends = hero.findFriends();
var enemy = hero.findNearestEnemy();
while (enemy) {
hero.moveXY(75, 47);
while(enemy){
if(enemy){
var enemy = hero.findNearestEnemy();
hero.attack(enemy);
}
}
hero.moveXY(50, 65);
while(enemy){
if(enemy){
var enemy = hero.findNearestEnemy();
hero.attack(enemy);
}
}
hero.moveXY(61, 29);
while(enemy){
if(enemy){
var enemy = hero.findNearestEnemy();
hero.attack(enemy);
}
}
}
// Use for-loop and for each friend:
for (var i = 0; i < friends.length; i++) {
var friend = friends[i];
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
});
}
}
}