distanceTo bug from object other than the player

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)

Are you sure that you have an item with distanceTo?

That’s what i’m requesting, if it’s not there or restricted for it to be opened up / implemented. :slight_smile:

But if it weren’t there it would say undefined function. It says is not allowed.

just checked this it works fine for me are you on a certain level?

How about now? It looks like the default API properties were distance and getNearest (the old names) instead of distanceTo and findNearest.