Skip to content

Commit e53fa0e

Browse files
committed
Added Body.Enable component
1 parent 7d56087 commit e53fa0e

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

v3/src/physics/arcade/ArcadeImage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var ArcadeImage = new Class({
1212
Components.Bounce,
1313
Components.Debug,
1414
Components.Drag,
15+
Components.Enable,
1516
Components.Friction,
1617
Components.Gravity,
1718
Components.Immovable,

v3/src/physics/arcade/ArcadeSprite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var ArcadeSprite = new Class({
1212
Components.Bounce,
1313
Components.Debug,
1414
Components.Drag,
15+
Components.Enable,
1516
Components.Friction,
1617
Components.Gravity,
1718
Components.Immovable,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var Enable = {
2+
3+
enableBody: function (reset, x, y)
4+
{
5+
this.body.enable = true;
6+
7+
if (reset)
8+
{
9+
this.body.reset(x, y);
10+
}
11+
12+
return this;
13+
},
14+
15+
disableBody: function (reset, x, y)
16+
{
17+
this.body.stop();
18+
19+
this.body.enable = false;
20+
21+
if (reset)
22+
{
23+
this.body.reset(x, y);
24+
}
25+
26+
return this;
27+
}
28+
29+
};
30+
31+
module.exports = Enable;

v3/src/physics/arcade/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
Bounce: require('./Bounce'),
88
Debug: require('./Debug'),
99
Drag: require('./Drag'),
10+
Enable: require('./Enable'),
1011
Friction: require('./Friction'),
1112
Gravity: require('./Gravity'),
1213
Immovable: require('./Immovable'),

0 commit comments

Comments
 (0)