Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Problem level!


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});

1 Like

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

1 Like