mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
23 lines
556 B
JavaScript
23 lines
556 B
JavaScript
|
// Module
|
||
|
var Shapes;
|
||
|
(function (Shapes) {
|
||
|
// Class
|
||
|
var Point = (function () {
|
||
|
// Constructor
|
||
|
function Point(x, y) {
|
||
|
this.x = x;
|
||
|
this.y = y;
|
||
|
}
|
||
|
Point.prototype.getDist = // Instance member
|
||
|
function () {
|
||
|
return Math.sqrt(this.x * this.x + this.y * this.y);
|
||
|
};
|
||
|
Point.origin = new Point(0, 0);
|
||
|
return Point;
|
||
|
})();
|
||
|
Shapes.Point = Point;
|
||
|
})(Shapes || (Shapes = {}));
|
||
|
// Local variables
|
||
|
var p = new Shapes.Point(3, 4);
|
||
|
var dist = p.getDist();
|