phaser/src/physics/impact/components/Velocity.js

94 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @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.Impact.Components.Velocity
* @since 3.0.0
*/
2017-08-15 22:36:00 +00:00
var Velocity = {
/**
* [description]
*
* @method Phaser.Physics.Impact.Components.Velocity#setVelocityX
* @since 3.0.0
*
* @param {[type]} x - [description]
*
* @return {[type]} [description]
*/
2017-08-15 22:36:00 +00:00
setVelocityX: function (x)
{
this.vel.x = x;
return this;
},
/**
* [description]
*
* @method Phaser.Physics.Impact.Components.Velocity#setVelocityY
* @since 3.0.0
*
* @param {[type]} y - [description]
*
* @return {[type]} [description]
*/
2017-08-15 22:36:00 +00:00
setVelocityY: function (y)
{
this.vel.y = y;
return this;
},
/**
* [description]
*
* @method Phaser.Physics.Impact.Components.Velocity#setVelocity
* @since 3.0.0
*
* @param {[type]} x - [description]
* @param {[type]} y - [description]
*
* @return {[type]} [description]
*/
2017-08-15 22:36:00 +00:00
setVelocity: function (x, y)
{
if (y === undefined) { y = x; }
2017-08-15 22:36:00 +00:00
this.vel.x = x;
this.vel.y = y;
return this;
},
/**
* [description]
*
* @method Phaser.Physics.Impact.Components.Velocity#setMaxVelocity
* @since 3.0.0
*
* @param {[type]} x - [description]
* @param {[type]} y - [description]
*
* @return {[type]} [description]
*/
2017-08-15 22:36:00 +00:00
setMaxVelocity: function (x, y)
{
if (y === undefined) { y = x; }
this.maxVel.x = x;
this.maxVel.y = y;
return this;
}
};
module.exports = Velocity;