dist/melonjs.js
function distanceTo(e) {
         var a = this.getBounds();
         var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
         // we have to use here the center of both entities

         var dx = a.pos.x + a.width / 2 - (b.pos.x + b.width / 2);
         var dy = a.pos.y + a.height / 2 - (b.pos.y + b.height / 2);
         return Math.sqrt(dx * dx + dy * dy);
       }
function distanceTo(e) {
         var a = this.getBounds();
         var b = e.getBounds(); // the me.Vector2d object also implements the same function, but
         // we have to use here the center of both entities

         var dx = a.pos.x + a.width / 2 - (b.pos.x + b.width / 2);
         var dy = a.pos.y + a.height / 2 - (b.pos.y + b.height / 2);
         return Math.sqrt(dx * dx + dy * dy);
       }
function distanceTo ( e ) { var a = this . getBounds ( ) ; var b = e . getBounds ( ) ; // the me.Vector2d object also implements the same function, but // we have to use here the center of both entities var dx = a . pos . x + a . width / 2 - ( b . pos . x + b . width / 2 ) ; var dy = a . pos . y + a . height / 2 - ( b . pos . y + b . height / 2 ) ; return Math . sqrt ( dx * dx + dy * dy ) ; }
return the distance to the specified entity
@name distanceTo
@memberOf me.Entity
@function
@param {me.Entity} entity Entity
@return {Number} distance
return the distance to the specified entity