Skip to content

Commit 3bbe07a

Browse files
committed
Added the new Arcade Physics Events
1 parent 671dfcd commit 3bbe07a

4 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var Class = require('../../../utils/Class');
2+
var Event = require('../../../events/Event');
3+
4+
var ArcadePhysicsCollideEvent = new Class({
5+
6+
Extends: Event,
7+
8+
initialize:
9+
10+
function ArcadePhysicsCollideEvent (gameObjectA, gameObjectB)
11+
{
12+
Event.call(this, 'ARCADE_COLLIDE_EVENT');
13+
14+
this.gameObjectA = gameObjectA;
15+
16+
this.gameObjectB = gameObjectB;
17+
18+
this.bodyA = gameObjectA.body;
19+
20+
this.bodyB = gameObjectB.body;
21+
}
22+
23+
});
24+
25+
module.exports = ArcadePhysicsCollideEvent;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var Class = require('../../../utils/Class');
2+
var Event = require('../../../events/Event');
3+
4+
var ArcadePhysicsOverlapEvent = new Class({
5+
6+
Extends: Event,
7+
8+
initialize:
9+
10+
function ArcadePhysicsOverlapEvent (gameObjectA, gameObjectB)
11+
{
12+
Event.call(this, 'ARCADE_OVERLAP_EVENT');
13+
14+
this.gameObjectA = gameObjectA;
15+
16+
this.gameObjectB = gameObjectB;
17+
18+
this.bodyA = gameObjectA.body;
19+
20+
this.bodyB = gameObjectB.body;
21+
}
22+
23+
});
24+
25+
module.exports = ArcadePhysicsOverlapEvent;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var Class = require('../../../utils/Class');
2+
var Event = require('../../../events/Event');
3+
4+
var ArcadePhysicsWorldBoundsEvent = new Class({
5+
6+
Extends: Event,
7+
8+
initialize:
9+
10+
function ArcadePhysicsWorldBoundsEvent (body)
11+
{
12+
Event.call(this, 'ARCADE_WORLD_BOUNDS_EVENT');
13+
14+
this.gameObject = body.gameObject;
15+
16+
this.body = body;
17+
18+
this.blockedUp = body.blocked.up;
19+
this.blockedDown = body.blocked.down;
20+
this.blockedLeft = body.blocked.left;
21+
this.blockedRight = body.blocked.right;
22+
}
23+
24+
});
25+
26+
module.exports = ArcadePhysicsWorldBoundsEvent;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Phaser.Physics.ArcadePhysics.Events
2+
3+
module.exports = {
4+
5+
OVERLAP: require('./ArcadePhysicsOverlapEvent'),
6+
COLLIDE: require('./ArcadePhysicsCollideEvent'),
7+
WORLD_BOUNDS: require('./ArcadePhysicsWorldBoundsEvent')
8+
9+
};

0 commit comments

Comments
 (0)