Problem level interception....help!


#1

my code

while(true) {
var enemy = hero.findNearest(hero.findEnemies());
var friend = hero.findFriends();
// Find the point between the enemy’s position and your friend’s position.
// Check the guide if you need more help!
if(enemy && friend){
var x = (enemy.x + friend.x)/2;
var y = (enemy.y + friend.y)/2;
hero.move({x: x, y: y});
}
}


#2

So friend is an array of friends here. Even there is only one friend, it will be the array with one friend.