2017-08-15 23:30:12 +00:00
|
|
|
|
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
var Components = require('./Components');
|
|
|
|
|
|
|
|
var ImpactBody = new Class({
|
|
|
|
|
|
|
|
Mixins: [
|
|
|
|
Components.Acceleration,
|
|
|
|
Components.BodyType,
|
|
|
|
Components.Bounce,
|
|
|
|
Components.CheckAgainst,
|
|
|
|
Components.Collides,
|
2017-08-16 18:31:59 +00:00
|
|
|
Components.Debug,
|
2017-08-15 23:30:12 +00:00
|
|
|
Components.Gravity,
|
|
|
|
Components.Velocity
|
|
|
|
],
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
2017-08-16 18:31:59 +00:00
|
|
|
// x/y is the top-left of the Body
|
2017-08-15 23:30:12 +00:00
|
|
|
function ImpactBody (world, x, y, width, height)
|
|
|
|
{
|
|
|
|
this.body = world.create(x, y, width, height);
|
|
|
|
|
|
|
|
// Local references to the Body properties
|
2017-08-16 16:27:15 +00:00
|
|
|
this.size = this.body.size;
|
2017-08-16 18:31:59 +00:00
|
|
|
this.offset = this.body.offset;
|
2017-08-15 23:30:12 +00:00
|
|
|
this.vel = this.body.vel;
|
|
|
|
this.accel = this.body.accel;
|
|
|
|
this.friction = this.body.friction;
|
|
|
|
this.maxVel = this.body.maxVel;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = ImpactBody;
|