mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Merge pull request #5315 from samme/feature/onWorldBounds
Add onWorldBounds argument in Arcade.Body#setCollideWorldBounds()
This commit is contained in:
commit
3672559fc1
1 changed files with 11 additions and 5 deletions
|
@ -1687,18 +1687,19 @@ var Body = new Class({
|
|||
/**
|
||||
* Sets whether this Body collides with the world boundary.
|
||||
*
|
||||
* Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
|
||||
* Optionally also sets the World Bounce and `onWorldBounds` values.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#setCollideWorldBounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`.
|
||||
* @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value.
|
||||
* @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value.
|
||||
* @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`.
|
||||
* @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value.
|
||||
* @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value.
|
||||
* @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Body} This Body object.
|
||||
*/
|
||||
setCollideWorldBounds: function (value, bounceX, bounceY)
|
||||
setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds)
|
||||
{
|
||||
if (value === undefined) { value = true; }
|
||||
|
||||
|
@ -1725,6 +1726,11 @@ var Body = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
if (onWorldBounds !== undefined)
|
||||
{
|
||||
this.onWorldBounds = onWorldBounds;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue