phaser/src/physics/matter-js/components/Friction.js

81 lines
1.7 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.Matter.Components.Friction
* @since 3.0.0
*/
var Friction = {
/**
* [description]
*
* @method Phaser.Physics.Matter.Components.Friction#setFriction
* @since 3.0.0
*
* @param {[type]} value - [description]
2018-03-19 00:10:32 +00:00
* @param {[type]} [air] - [description]
* @param {[type]} [fstatic] - [description]
*
2018-03-19 00:10:32 +00:00
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
2017-12-12 17:02:53 +00:00
setFriction: function (value, air, fstatic)
{
this.body.friction = value;
2017-11-27 03:44:31 +00:00
if (air !== undefined)
{
this.body.frictionAir = air;
}
2017-12-12 17:02:53 +00:00
if (fstatic !== undefined)
2017-11-27 03:44:31 +00:00
{
2017-12-12 17:02:53 +00:00
this.body.frictionStatic = fstatic;
2017-11-27 03:44:31 +00:00
}
return this;
},
/**
* [description]
*
* @method Phaser.Physics.Matter.Components.Friction#setFrictionAir
* @since 3.0.0
*
* @param {[type]} value - [description]
*
2018-03-19 00:10:32 +00:00
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
setFrictionAir: function (value)
{
this.body.frictionAir = value;
return this;
},
/**
* [description]
*
* @method Phaser.Physics.Matter.Components.Friction#setFrictionStatic
* @since 3.0.0
*
* @param {[type]} value - [description]
*
2018-03-19 00:10:32 +00:00
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
setFrictionStatic: function (value)
{
this.body.frictionStatic = value;
return this;
}
};
module.exports = Friction;