phaser/src/physics/impact/ImpactBody.js

128 lines
3.5 KiB
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
2019-01-15 16:20:22 +00:00
* @copyright 2019 Photon Storm Ltd.
2018-02-12 16:01:20 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Class = require('../../utils/Class');
var Components = require('./components');
2018-02-09 16:04:43 +00:00
/**
* @classdesc
* [description]
*
* @class ImpactBody
2018-10-10 09:49:13 +00:00
* @memberof Phaser.Physics.Impact
2018-02-09 16:04:43 +00:00
* @constructor
* @since 3.0.0
*
* @extends Phaser.Physics.Impact.Components.Acceleration
* @extends Phaser.Physics.Impact.Components.BodyScale
* @extends Phaser.Physics.Impact.Components.BodyType
* @extends Phaser.Physics.Impact.Components.Bounce
* @extends Phaser.Physics.Impact.Components.CheckAgainst
* @extends Phaser.Physics.Impact.Components.Collides
* @extends Phaser.Physics.Impact.Components.Debug
* @extends Phaser.Physics.Impact.Components.Friction
* @extends Phaser.Physics.Impact.Components.Gravity
* @extends Phaser.Physics.Impact.Components.Offset
* @extends Phaser.Physics.Impact.Components.SetGameObject
* @extends Phaser.Physics.Impact.Components.Velocity
*
* @param {Phaser.Physics.Impact.World} world - [description]
2018-10-19 11:32:43 +00:00
* @param {number} x - x - The horizontal position of this physics body in the world.
* @param {number} y - y - The vertical position of this physics body in the world.
* @param {number} width - The width of the physics body in the world.
2018-02-09 16:04:43 +00:00
* @param {number} height - [description]
*/
var ImpactBody = new Class({
Mixins: [
Components.Acceleration,
Components.BodyScale,
Components.BodyType,
Components.Bounce,
Components.CheckAgainst,
Components.Collides,
Components.Debug,
2017-08-17 02:48:39 +00:00
Components.Friction,
Components.Gravity,
2017-08-16 21:10:43 +00:00
Components.Offset,
Components.SetGameObject,
Components.Velocity
],
initialize:
function ImpactBody (world, x, y, width, height)
{
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#body
* @type {Phaser.Physics.Impact.Body}
* @since 3.0.0
*/
this.body = world.create(x, y, width, height);
this.body.parent = this;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#size
* @type {{x: number, y: number}}
* @since 3.0.0
*/
2017-08-16 16:27:15 +00:00
this.size = this.body.size;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#offset
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.offset = this.body.offset;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#vel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.vel = this.body.vel;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#accel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.accel = this.body.accel;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#friction
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.friction = this.body.friction;
2018-02-09 16:04:43 +00:00
/**
* [description]
*
* @name Phaser.Physics.Impact.ImpactBody#maxVel
* @type {{x: number, y: number}}
* @since 3.0.0
*/
this.maxVel = this.body.maxVel;
}
});
module.exports = ImpactBody;