It seems we can not access the method distanceTo from an enemy object. It doesn’t matter what you pass into distanceTo, an item object or an object with x and y coords on it. it says this.
Calling distanceTo is not allowed.
var enemy = this.findNearest(this.findEnemies());
if (enemy) {
this.say(enemy.distanceTo({x: 5, y: 5}));
}
I need this functionality to determine if the enemy hero is nearby the next coordinate i wish to move to. (to direct my player to move the other direction instead)