mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Merge pull request #5322 from samme/feature/setMaxVelocity
Set maxVelocity in PhysicsGroupConfig
This commit is contained in:
commit
1f9243fe81
3 changed files with 38 additions and 0 deletions
|
@ -1819,6 +1819,40 @@ var Body = new Class({
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Body's maximum horizontal velocity.
|
||||||
|
*
|
||||||
|
* @method Phaser.Physics.Arcade.Body#setMaxVelocityX
|
||||||
|
* @since 3.50.0
|
||||||
|
*
|
||||||
|
* @param {number} value - The maximum horizontal velocity, in pixels per second.
|
||||||
|
*
|
||||||
|
* @return {Phaser.Physics.Arcade.Body} This Body object.
|
||||||
|
*/
|
||||||
|
setMaxVelocityX: function (value)
|
||||||
|
{
|
||||||
|
this.maxVelocity.x = value;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Body's maximum vertical velocity.
|
||||||
|
*
|
||||||
|
* @method Phaser.Physics.Arcade.Body#setMaxVelocityY
|
||||||
|
* @since 3.50.0
|
||||||
|
*
|
||||||
|
* @param {number} value - The maximum vertical velocity, in pixels per second.
|
||||||
|
*
|
||||||
|
* @return {Phaser.Physics.Arcade.Body} This Body object.
|
||||||
|
*/
|
||||||
|
setMaxVelocityY: function (value)
|
||||||
|
{
|
||||||
|
this.maxVelocity.y = value;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum speed the Body can move.
|
* Sets the maximum speed the Body can move.
|
||||||
*
|
*
|
||||||
|
|
|
@ -145,6 +145,8 @@ var PhysicsGroup = new Class({
|
||||||
setGravityY: GetFastValue(config, 'gravityY', 0),
|
setGravityY: GetFastValue(config, 'gravityY', 0),
|
||||||
setFrictionX: GetFastValue(config, 'frictionX', 0),
|
setFrictionX: GetFastValue(config, 'frictionX', 0),
|
||||||
setFrictionY: GetFastValue(config, 'frictionY', 0),
|
setFrictionY: GetFastValue(config, 'frictionY', 0),
|
||||||
|
setMaxVelocityX: GetFastValue(config, 'maxVelocityX', 10000),
|
||||||
|
setMaxVelocityY: GetFastValue(config, 'maxVelocityY', 10000),
|
||||||
setVelocityX: GetFastValue(config, 'velocityX', 0),
|
setVelocityX: GetFastValue(config, 'velocityX', 0),
|
||||||
setVelocityY: GetFastValue(config, 'velocityY', 0),
|
setVelocityY: GetFastValue(config, 'velocityY', 0),
|
||||||
setAngularVelocity: GetFastValue(config, 'angularVelocity', 0),
|
setAngularVelocity: GetFastValue(config, 'angularVelocity', 0),
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
* @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}.
|
* @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}.
|
||||||
* @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}.
|
* @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}.
|
||||||
* @property {number} [frictionY=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.y}.
|
* @property {number} [frictionY=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.y}.
|
||||||
|
* @property {number} [maxVelocityX=10000] - Sets {@link Phaser.Physics.Arcade.Body#maxVelocity maxVelocity.x}.
|
||||||
|
* @property {number} [maxVelocityY=10000] - Sets {@link Phaser.Physics.Arcade.Body#maxVelocity maxVelocity.y}.
|
||||||
* @property {number} [velocityX=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.x}.
|
* @property {number} [velocityX=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.x}.
|
||||||
* @property {number} [velocityY=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.y}.
|
* @property {number} [velocityY=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.y}.
|
||||||
* @property {number} [angularVelocity=0] - Sets {@link Phaser.Physics.Arcade.Body#angularVelocity}.
|
* @property {number} [angularVelocity=0] - Sets {@link Phaser.Physics.Arcade.Body#angularVelocity}.
|
||||||
|
|
Loading…
Reference in a new issue