Skip to content

Commit a84b9d5

Browse files
committed
Added all of the Arcade Physics image and sprite components
1 parent 5a20ea0 commit a84b9d5

11 files changed

Lines changed: 295 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var Acceleration = {
2+
3+
setAcceleration: function (x, y)
4+
{
5+
this.body.acceleration.set(x, y);
6+
7+
return this;
8+
},
9+
10+
setAccelerationX: function (value)
11+
{
12+
this.body.acceleration.x = value;
13+
14+
return this;
15+
},
16+
17+
setAccelerationY: function (value)
18+
{
19+
this.body.acceleration.y = value;
20+
21+
return this;
22+
}
23+
24+
};
25+
26+
module.exports = Acceleration;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var Angular = {
2+
3+
setAngularVelocity: function (value)
4+
{
5+
this.body.angularVelocity = value;
6+
7+
return this;
8+
},
9+
10+
setAngularAcceleration: function (value)
11+
{
12+
this.body.angularAcceleration = value;
13+
14+
return this;
15+
},
16+
17+
setAngularDrag: function (value)
18+
{
19+
this.body.angularDrag = value;
20+
21+
return this;
22+
}
23+
24+
};
25+
26+
module.exports = Angular;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var Bounce = {
2+
3+
setBounce: function (x, y)
4+
{
5+
this.body.bounce.set(x, y);
6+
7+
return this;
8+
},
9+
10+
setBounceX: function (value)
11+
{
12+
this.body.bounce.x = value;
13+
14+
return this;
15+
},
16+
17+
setBounceY: function (value)
18+
{
19+
this.body.bounce.y = value;
20+
21+
return this;
22+
},
23+
24+
setCollideWorldBounds: function (value)
25+
{
26+
this.body.collideWorldBounds = value;
27+
28+
return this;
29+
}
30+
31+
};
32+
33+
module.exports = Bounce;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
var Debug = {
2+
3+
setDebug: function (showBody, showVelocity, bodyColor)
4+
{
5+
this.debugShowBody = showBody;
6+
this.debugShowVelocity = showVelocity;
7+
this.debugBodyColor = bodyColor;
8+
9+
return this;
10+
},
11+
12+
setDebugBodyColor: function (value)
13+
{
14+
this.body.debugBodyColor = value;
15+
16+
return this;
17+
},
18+
19+
debugShowBody: {
20+
21+
get: function ()
22+
{
23+
return this.body.debugShowBody;
24+
},
25+
26+
set: function (value)
27+
{
28+
this.body.debugShowBody = value;
29+
}
30+
31+
},
32+
33+
debugShowVelocity: {
34+
35+
get: function ()
36+
{
37+
return this.body.debugShowVelocity;
38+
},
39+
40+
set: function (value)
41+
{
42+
this.body.debugShowVelocity = value;
43+
}
44+
45+
},
46+
47+
debugBodyColor: {
48+
49+
get: function ()
50+
{
51+
return this.body.debugBodyColor;
52+
},
53+
54+
set: function (value)
55+
{
56+
this.body.debugBodyColor = value;
57+
}
58+
59+
}
60+
61+
};
62+
63+
module.exports = Debug;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var Drag = {
2+
3+
setDrag: function (x, y)
4+
{
5+
this.body.drag.set(x, y);
6+
7+
return this;
8+
},
9+
10+
setDragX: function (value)
11+
{
12+
this.body.drag.x = value;
13+
14+
return this;
15+
},
16+
17+
setDragY: function (value)
18+
{
19+
this.body.drag.y = value;
20+
21+
return this;
22+
}
23+
24+
};
25+
26+
module.exports = Drag;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var Friction = {
2+
3+
setFriction: function (x, y)
4+
{
5+
this.body.friction.set(x, y);
6+
7+
return this;
8+
},
9+
10+
setFrictionX: function (x)
11+
{
12+
this.body.friction.x = x;
13+
14+
return this;
15+
},
16+
17+
setFrictionY: function (y)
18+
{
19+
this.body.friction.y = y;
20+
21+
return this;
22+
}
23+
24+
};
25+
26+
module.exports = Friction;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var Immovable = {
2+
3+
setImmovable: function (value)
4+
{
5+
this.body.immovable = value;
6+
7+
return this;
8+
}
9+
10+
};
11+
12+
module.exports = Immovable;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var Mass = {
2+
3+
setMass: function (value)
4+
{
5+
this.body.mass = value;
6+
7+
return this;
8+
}
9+
10+
};
11+
12+
module.exports = Mass;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var Size = {
2+
3+
setSize: function (width, height, offsetX, offsetY)
4+
{
5+
this.body.setSize(width, height, offsetX, offsetY);
6+
7+
return this;
8+
},
9+
10+
setCircle: function (radius, offsetX, offsetY)
11+
{
12+
this.body.setCircle(radius, offsetX, offsetY);
13+
14+
return this;
15+
}
16+
17+
};
18+
19+
module.exports = Size;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var Velocity = {
2+
3+
setVelocity: function (x, y)
4+
{
5+
this.body.velocity.set(x, y);
6+
7+
return this;
8+
},
9+
10+
setVelocityX: function (x)
11+
{
12+
this.body.velocity.x = x;
13+
14+
return this;
15+
},
16+
17+
setVelocityY: function (y)
18+
{
19+
this.body.velocity.y = y;
20+
21+
return this;
22+
},
23+
24+
setMaxVelocity: function (x, y)
25+
{
26+
if (y === undefined) { y = x; }
27+
28+
this.body.maxVelocity.set(x, y);
29+
30+
return this;
31+
}
32+
33+
};
34+
35+
module.exports = Velocity;

0 commit comments

Comments
 (0)