Skip to content

Commit 3672559

Browse files
authored
Merge pull request phaserjs#5315 from samme/feature/onWorldBounds
Add onWorldBounds argument in Arcade.Body#setCollideWorldBounds()
2 parents e7f6e8a + 2eb505c commit 3672559

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,18 +1687,19 @@ var Body = new Class({
16871687
/**
16881688
* Sets whether this Body collides with the world boundary.
16891689
*
1690-
* Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
1690+
* Optionally also sets the World Bounce and `onWorldBounds` values.
16911691
*
16921692
* @method Phaser.Physics.Arcade.Body#setCollideWorldBounds
16931693
* @since 3.0.0
16941694
*
1695-
* @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`.
1696-
* @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value.
1697-
* @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value.
1695+
* @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`.
1696+
* @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value.
1697+
* @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value.
1698+
* @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value.
16981699
*
16991700
* @return {Phaser.Physics.Arcade.Body} This Body object.
17001701
*/
1701-
setCollideWorldBounds: function (value, bounceX, bounceY)
1702+
setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds)
17021703
{
17031704
if (value === undefined) { value = true; }
17041705

@@ -1725,6 +1726,11 @@ var Body = new Class({
17251726
}
17261727
}
17271728

1729+
if (onWorldBounds !== undefined)
1730+
{
1731+
this.onWorldBounds = onWorldBounds;
1732+
}
1733+
17281734
return this;
17291735
},
17301736

0 commit comments

Comments
 (0)