mirror of
https://github.com/wassname/phaser.git
synced 2026-08-19 12:30:07 +08:00
Updated docs for 1.1.2 release.
This commit is contained in:
+46
-7
@@ -58,10 +58,6 @@
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Bullet.html">Bullet</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Button.html">Button</a>
|
||||
</li>
|
||||
@@ -598,9 +594,7 @@ Phaser.Point.prototype = {
|
||||
* @return {number} The distance between this Point object and the destination Point object.
|
||||
*/
|
||||
distance: function (dest, round) {
|
||||
|
||||
return Phaser.Point.distance(this, dest, round);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -627,6 +621,51 @@ Phaser.Point.prototype = {
|
||||
return Phaser.Point.rotate(this, x, y, angle, asDegrees, distance);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the length of the vector
|
||||
* @method Phaser.Point#getMagnitude
|
||||
* @return {number} the length of the vector
|
||||
*/
|
||||
getMagnitude: function() {
|
||||
return Math.sqrt((this.x * this.x) + (this.y * this.y));
|
||||
},
|
||||
|
||||
/**
|
||||
* Alters the length of the vector without changing the direction
|
||||
* @method Phaser.Point#getMagnitude
|
||||
* @param {number} magnitude the desired magnitude of the resulting vector
|
||||
* @return {Phaser.Point} the modified original vector
|
||||
*/
|
||||
setMagnitude: function(magnitude) {
|
||||
return this.normalize().multiply(magnitude, magnitude);
|
||||
},
|
||||
|
||||
/**
|
||||
* Alters the vector so that its length is 1, but it retains the same direction
|
||||
* @method Phaser.Point#normalize
|
||||
* @return {Phaser.Point} the modified original vector
|
||||
*/
|
||||
normalize: function() {
|
||||
|
||||
if(!this.isZero()) {
|
||||
var m = this.getMagnitude();
|
||||
this.x /= m;
|
||||
this.y /= m;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine if this point is at 0,0
|
||||
* @method Phaser.Point#isZero
|
||||
* @return {boolean} True if this Point is 0,0, otherwise false
|
||||
*/
|
||||
isZero: function() {
|
||||
return (this.x === 0 && this.y === 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object.
|
||||
* @method Phaser.Point#toString
|
||||
@@ -799,7 +838,7 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Fri Nov 01 2013 18:16:08 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user