Skip to content

Commit a9938ba

Browse files
authored
Merge pull request phaserjs#4070 from samme/feature/arcade-group-config-enable
Add PhysicsGroupConfig.enable, Arcade.Body#setEnable()
2 parents 3c5bf3e + 69ff71e commit a9938ba

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,25 @@ var Body = new Class({
19551955
return this;
19561956
},
19571957

1958+
/**
1959+
* Sets the Body's `enable` property.
1960+
*
1961+
* @method Phaser.Physics.Arcade.Body#setEnable
1962+
* @since 3.14.0
1963+
*
1964+
* @param {boolean} [value=true] - The value to assign to `enable`.
1965+
*
1966+
* @return {Phaser.Physics.Arcade.Body} This Body object.
1967+
*/
1968+
setEnable: function (value)
1969+
{
1970+
if (value === undefined) { value = true; }
1971+
1972+
this.enable = value;
1973+
1974+
return this;
1975+
},
1976+
19581977
/**
19591978
* The Body's horizontal position (left edge).
19601979
*

src/physics/arcade/PhysicsGroup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject');
2525
* @property {number} [bounceY=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.y}.
2626
* @property {number} [dragX=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.x}.
2727
* @property {number} [dragY=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.y}.
28+
* @property {boolean} [enable=true] - Sets {@link Phaser.Physics.Arcade.Body#enable enable}.
2829
* @property {number} [gravityX=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.x}.
2930
* @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}.
3031
* @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}.
@@ -51,6 +52,7 @@ var IsPlainObject = require('../../utils/object/IsPlainObject');
5152
* @property {number} setBounceY - As {@link Phaser.Physics.Arcade.Body#setBounceY}.
5253
* @property {number} setDragX - As {@link Phaser.Physics.Arcade.Body#setDragX}.
5354
* @property {number} setDragY - As {@link Phaser.Physics.Arcade.Body#setDragY}.
55+
* @property {boolean} setEnable - As {@link Phaser.Physics.Arcade.Body#setEnable}.
5456
* @property {number} setGravityX - As {@link Phaser.Physics.Arcade.Body#setGravityX}.
5557
* @property {number} setGravityY - As {@link Phaser.Physics.Arcade.Body#setGravityY}.
5658
* @property {number} setFrictionX - As {@link Phaser.Physics.Arcade.Body#setFrictionX}.
@@ -167,6 +169,7 @@ var PhysicsGroup = new Class({
167169
setBounceY: GetFastValue(config, 'bounceY', 0),
168170
setDragX: GetFastValue(config, 'dragX', 0),
169171
setDragY: GetFastValue(config, 'dragY', 0),
172+
setEnable: GetFastValue(config, 'enable', true),
170173
setGravityX: GetFastValue(config, 'gravityX', 0),
171174
setGravityY: GetFastValue(config, 'gravityY', 0),
172175
setFrictionX: GetFastValue(config, 'frictionX', 0),

0 commit comments

Comments
 (0)