UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

70 lines (60 loc) 1.51 kB
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * [description] * * @name Phaser.Physics.Arcade.Components.Gravity * @since 3.0.0 */ var Gravity = { /** * [description] * * @method Phaser.Physics.Arcade.Components.Gravity#setGravity * @since 3.0.0 * * @param {number} x - [description] * @param {number} [y=x] - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. */ setGravity: function (x, y) { this.body.gravity.set(x, y); return this; }, /** * [description] * * @method Phaser.Physics.Arcade.Components.Gravity#setGravityX * @since 3.0.0 * * @param {number} x - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. */ setGravityX: function (x) { this.body.gravity.x = x; return this; }, /** * [description] * * @method Phaser.Physics.Arcade.Components.Gravity#setGravityY * @since 3.0.0 * * @param {number} y - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. */ setGravityY: function (y) { this.body.gravity.y = y; return this; } }; module.exports = Gravity;