mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Added the new Arcade Physics Events
This commit is contained in:
parent
671dfcd569
commit
3bbe07afb1
4 changed files with 85 additions and 0 deletions
25
v3/src/physics/arcade/events/ArcadePhysicsCollideEvent.js
Normal file
25
v3/src/physics/arcade/events/ArcadePhysicsCollideEvent.js
Normal 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;
|
25
v3/src/physics/arcade/events/ArcadePhysicsOverlapEvent.js
Normal file
25
v3/src/physics/arcade/events/ArcadePhysicsOverlapEvent.js
Normal 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;
|
|
@ -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;
|
9
v3/src/physics/arcade/events/index.js
Normal file
9
v3/src/physics/arcade/events/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Phaser.Physics.ArcadePhysics.Events
|
||||
|
||||
module.exports = {
|
||||
|
||||
OVERLAP: require('./ArcadePhysicsOverlapEvent'),
|
||||
COLLIDE: require('./ArcadePhysicsCollideEvent'),
|
||||
WORLD_BOUNDS: require('./ArcadePhysicsWorldBoundsEvent')
|
||||
|
||||
};
|
Loading…
Reference in a new issue