Skip to content

Instantly share code, notes, and snippets.

@caubry
Last active December 13, 2015 17:09
Show Gist options
  • Save caubry/4945801 to your computer and use it in GitHub Desktop.
Save caubry/4945801 to your computer and use it in GitHub Desktop.
private function calculateDistance(xPos:Number, yPos:Number, xPos2:Number, yPos2:Number):Number
{
var diffX:Number = xPos - xPos2;
var diffY:Number = yPos - yPos2;
var distance:Number = Math.sqrt(diffX * diffX + diffY * diffY);
if (distance < 0)
{
distance *= 1;
}
return distance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment