Added the new Arcade Physics Events

This commit is contained in:
Richard Davey 2017-11-09 04:00:17 +00:00
parent 671dfcd569
commit 3bbe07afb1
4 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,25 @@
var Class = require('../../../utils/Class');
var Event = require('../../../events/Event');
var ArcadePhysicsCollideEvent = new Class({
Extends: Event,
initialize:
function ArcadePhysicsCollideEvent (gameObjectA, gameObjectB)
{
Event.call(this, 'ARCADE_COLLIDE_EVENT');
this.gameObjectA = gameObjectA;
this.gameObjectB = gameObjectB;
this.bodyA = gameObjectA.body;
this.bodyB = gameObjectB.body;
}
});
module.exports = ArcadePhysicsCollideEvent;

View file

@ -0,0 +1,25 @@
var Class = require('../../../utils/Class');
var Event = require('../../../events/Event');
var ArcadePhysicsOverlapEvent = new Class({
Extends: Event,
initialize:
function ArcadePhysicsOverlapEvent (gameObjectA, gameObjectB)
{
Event.call(this, 'ARCADE_OVERLAP_EVENT');
this.gameObjectA = gameObjectA;
this.gameObjectB = gameObjectB;
this.bodyA = gameObjectA.body;
this.bodyB = gameObjectB.body;
}
});
module.exports = ArcadePhysicsOverlapEvent;

View file

@ -0,0 +1,26 @@
var Class = require('../../../utils/Class');
var Event = require('../../../events/Event');
var ArcadePhysicsWorldBoundsEvent = new Class({
Extends: Event,
initialize:
function ArcadePhysicsWorldBoundsEvent (body)
{
Event.call(this, 'ARCADE_WORLD_BOUNDS_EVENT');
this.gameObject = body.gameObject;
this.body = body;
this.blockedUp = body.blocked.up;
this.blockedDown = body.blocked.down;
this.blockedLeft = body.blocked.left;
this.blockedRight = body.blocked.right;
}
});
module.exports = ArcadePhysicsWorldBoundsEvent;

View file

@ -0,0 +1,9 @@
// Phaser.Physics.ArcadePhysics.Events
module.exports = {
OVERLAP: require('./ArcadePhysicsOverlapEvent'),
COLLIDE: require('./ArcadePhysicsCollideEvent'),
WORLD_BOUNDS: require('./ArcadePhysicsWorldBoundsEvent')
};