Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Is there anyway to find the nearest x, y coordinates


In Sarven Treasure I cannot findnearest x, y coordinates. I need this help because i keep getting ambushed by ogre’s


Not sure I understand your issue:
Your position is given by:
this.pos, with the x,y being this.pos.x and this.pos.x
An enemy’s position is enemy.pos
The nearest enemy is this.findNearestEnemy() or this.findNearest(this.findEnemies())


I meant I cannot find the red x’s using x’y coordinates.


see here: Sarven Treasure Teleporter Positions


Thanks! I completed the level.


I’m just uessing but i think you could use the pythagon theroum to mesure the distance or something like that and use a if starement to see if you should subtract or not. You get what im saying, right?


Yeah, thanks for the idea.