Skip to content

Commit 5a20ea0

Browse files
committed
ArcadeImage and ArcadeSprite are helper classes, much like ImpactImage
1 parent 508a524 commit 5a20ea0

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var Class = require('../../utils/Class');
2+
var Components = require('./components');
3+
var Image = require('../../gameobjects/image/Image');
4+
5+
var ArcadeImage = new Class({
6+
7+
Extends: Image,
8+
9+
Mixins: [
10+
Components.Acceleration,
11+
Components.Angular,
12+
Components.Bounce,
13+
Components.Debug,
14+
Components.Drag,
15+
Components.Friction,
16+
Components.Gravity,
17+
Components.Immovable,
18+
Components.Mass,
19+
Components.Size,
20+
Components.Velocity
21+
],
22+
23+
initialize:
24+
25+
// x/y is the center of the Image / Body, just like other default Game Objects
26+
function ArcadeImage (scene, x, y, texture, frame)
27+
{
28+
Image.call(this, scene, x, y, texture, frame);
29+
30+
scene.sys.physicsManager.world.enableBody(this);
31+
}
32+
33+
});
34+
35+
module.exports = ArcadeImage;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var Class = require('../../utils/Class');
2+
var Components = require('./components');
3+
var Sprite = require('../../gameobjects/sprite/Sprite');
4+
5+
var ArcadeSprite = new Class({
6+
7+
Extends: Sprite,
8+
9+
Mixins: [
10+
Components.Acceleration,
11+
Components.Angular,
12+
Components.Bounce,
13+
Components.Debug,
14+
Components.Drag,
15+
Components.Friction,
16+
Components.Gravity,
17+
Components.Immovable,
18+
Components.Mass,
19+
Components.Size,
20+
Components.Velocity
21+
],
22+
23+
initialize:
24+
25+
// x/y is the center of the Sprite / Body, just like other default Game Objects
26+
function ArcadeSprite (scene, x, y, texture, frame)
27+
{
28+
Sprite.call(this, scene, x, y, texture, frame);
29+
30+
scene.sys.physicsManager.world.enableBody(this);
31+
}
32+
33+
});
34+
35+
module.exports = ArcadeSprite;

0 commit comments

Comments
 (0)