2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2019-01-15 16:20:22 +00:00
|
|
|
* @copyright 2019 Photon Storm Ltd.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-02-12 16:01:20 +00:00
|
|
|
*/
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
2018-09-28 11:19:21 +00:00
|
|
|
* The Impact Acceleration component.
|
|
|
|
* Should be applied as a mixin.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
2019-02-12 15:01:54 +00:00
|
|
|
* @namespace Phaser.Physics.Impact.Components.Acceleration
|
2018-02-09 01:40:41 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
var Acceleration = {
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
2018-09-28 11:19:21 +00:00
|
|
|
* Sets the horizontal acceleration of this body.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.Acceleration#setAccelerationX
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @param {number} x - The amount of acceleration to apply.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @return {this} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setAccelerationX: function (x)
|
|
|
|
{
|
|
|
|
this.accel.x = x;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
2018-09-28 11:19:21 +00:00
|
|
|
* Sets the vertical acceleration of this body.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.Acceleration#setAccelerationY
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @param {number} y - The amount of acceleration to apply.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @return {this} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setAccelerationY: function (y)
|
|
|
|
{
|
|
|
|
this.accel.y = y;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 01:40:41 +00:00
|
|
|
/**
|
2018-09-28 11:19:21 +00:00
|
|
|
* Sets the horizontal and vertical acceleration of this body.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
|
|
|
* @method Phaser.Physics.Impact.Components.Acceleration#setAcceleration
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @param {number} x - The amount of horizontal acceleration to apply.
|
|
|
|
* @param {number} y - The amount of vertical acceleration to apply.
|
2018-02-09 01:40:41 +00:00
|
|
|
*
|
2018-09-28 11:19:21 +00:00
|
|
|
* @return {this} This Game Object.
|
2018-02-09 01:40:41 +00:00
|
|
|
*/
|
2017-08-15 22:36:00 +00:00
|
|
|
setAcceleration: function (x, y)
|
|
|
|
{
|
|
|
|
this.accel.x = x;
|
|
|
|
this.accel.y = y;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Acceleration;
|