Lots more physics tests and updates.

PLEASE DO NOT upgrade to this release if you need your game working and it uses any of the physics functions, as they're nearly all broken here.
Just pushing up so I can share it with someone.
This commit is contained in:
photonstorm
2014-01-20 20:14:34 +00:00
parent 2532df8793
commit 128c7143d5
17 changed files with 1623 additions and 99 deletions
+21 -2
View File
@@ -327,7 +327,7 @@ Phaser.Math = {
},
/**
* Find the angle of a segment from (x1, y1) -> (x2, y2 ).
* Find the angle of a segment from (x1, y1) -> (x2, y2).
* @method Phaser.Math#angleBetween
* @param {number} x1
* @param {number} y1
@@ -971,7 +971,7 @@ Phaser.Math = {
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @return {number} The distance between this Point object and the destination Point object.
* @return {number} The distance between the two sets of coordinates.
*/
distance: function (x1, y1, x2, y2) {
@@ -982,6 +982,25 @@ Phaser.Math = {
},
/**
* Returns the distance between the two given set of coordinates at the power given.
*
* @method Phaser.Math#distancePow
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} [pow=2]
* @return {number} The distance between the two sets of coordinates.
*/
distancePow: function (x1, y1, x2, y2, pow) {
if (typeof pow === 'undefined') { pow = 2; }
return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow));
},
/**
* Returns the rounded distance between the two given set of coordinates.
*