ippa / jaws

Jaws - HTML5 canvas javascript 2D Game Framework
https://jawsjs.ippa.se
GNU Lesser General Public License v3.0
363 stars 75 forks source link

distanceBetween seems to have an obvious bug... #22

Closed rozim closed 12 years ago

rozim commented 12 years ago

jaws.distanceBetween = function(object1, object2) { return Math.sqrt( Math.pow(object1.x-object2.x, 2) + Math.pow(object1.y, object2.y, 2) ) }

I think the last pow call needs to subtract the y's like this: Math.pow(object1.y - object2.y, 2)

ippa commented 12 years ago

tnx for the report, fixed in https://github.com/ippa/jaws/commit/d19fc9ff90d7cd46c4e09727355f2f9d82f720e0