arcade-physics
Version:
Use Arcade Physics without Phaser.
86 lines • 2.32 kB
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Class_1 = __importDefault(require("../../utils/Class"));
const const_1 = __importDefault(require("../const"));
/**
* @classdesc
* Defines a Point in 2D space, with an x and y component.
*
* @class Point
* @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
* @param {number} [x=0] - The x coordinate of this Point.
* @param {number} [y=x] - The y coordinate of this Point.
*/
const Point = new Class_1.default({
initialize: function Point(x, y) {
if (x === undefined) {
x = 0;
}
if (y === undefined) {
y = x;
}
/**
* The geometry constant type of this object: `GEOM_CONST.POINT`.
* Used for fast type comparisons.
*
* @name Phaser.Geom.Point#type
* @type {number}
* @readonly
* @since 3.19.0
*/
this.type = const_1.default.POINT;
/**
* The x coordinate of this Point.
*
* @name Phaser.Geom.Point#x
* @type {number}
* @default 0
* @since 3.0.0
*/
this.x = x;
/**
* The y coordinate of this Point.
*
* @name Phaser.Geom.Point#y
* @type {number}
* @default 0
* @since 3.0.0
*/
this.y = y;
},
/**
* Set the x and y coordinates of the point to the given values.
*
* @method Phaser.Geom.Point#setTo
* @since 3.0.0
*
* @param {number} [x=0] - The x coordinate of this Point.
* @param {number} [y=x] - The y coordinate of this Point.
*
* @return {this} This Point object.
*/
setTo: function (x, y) {
if (x === undefined) {
x = 0;
}
if (y === undefined) {
y = x;
}
this.x = x;
this.y = y;
return this;
}
});
exports.default = Point;
//# sourceMappingURL=Point.js.map