mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 17:16:03 +00:00
20 lines
457 B
JavaScript
20 lines
457 B
JavaScript
|
var Shapes;
|
||
|
(function (Shapes) {
|
||
|
|
||
|
var Point = Shapes.Point = (function () {
|
||
|
function Point(x, y) {
|
||
|
this.x = x;
|
||
|
this.y = y;
|
||
|
}
|
||
|
Point.prototype.getDist = function () {
|
||
|
return Math.sqrt((this.x * this.x) + (this.y * this.y));
|
||
|
};
|
||
|
Point.origin = new Point(0, 0);
|
||
|
return Point;
|
||
|
})();
|
||
|
|
||
|
})(Shapes || (Shapes = {}));
|
||
|
|
||
|
var p = new Shapes.Point(3, 4);
|
||
|
var dist = p.getDist();
|