mirror of
https://github.com/wassname/phaser.git
synced 2026-07-17 11:31:30 +08:00
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:
+21
-2
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user