mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Fix "object" types on Physics and Math
This commit is contained in:
parent
0c1ced8d86
commit
11845f9d6d
12 changed files with 256 additions and 50 deletions
|
@ -4,6 +4,13 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} SinCosTable
|
||||
*
|
||||
* @property {number} sin - [description]
|
||||
* @property {number} cos - [description]
|
||||
* @property {number} length - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* [description]
|
||||
|
@ -16,7 +23,7 @@
|
|||
* @param {number} cosAmp - [description]
|
||||
* @param {number} frequency - [description]
|
||||
*
|
||||
* @return {object} [description]
|
||||
* @return {SinCosTable} [description]
|
||||
*/
|
||||
var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ var Vector2 = new Class({
|
|||
* @method Phaser.Math.Vector2#copy
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {(Phaser.Math.Vector2|Vector2Like)} src - [description]
|
||||
* @param {Phaser.Math.Vector2} src - [description]
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} This Vector2.
|
||||
*/
|
||||
|
@ -105,7 +105,7 @@ var Vector2 = new Class({
|
|||
* @method Phaser.Math.Vector2#setFromObject
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} obj - [description]
|
||||
* @param {Vector2Like} obj - [description]
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} This Vector2.
|
||||
*/
|
||||
|
|
|
@ -146,7 +146,7 @@ var ArcadePhysics = new Class({
|
|||
* @param {(Phaser.GameObjects.GameObject|array)} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
|
||||
* @param {ArcadePhysicsCallback} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter.
|
||||
* @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`.
|
||||
* @param {object} [callbackContext] - The context in which to run the callbacks.
|
||||
* @param {*} [callbackContext] - The context in which to run the callbacks.
|
||||
*
|
||||
* @return {boolean} True if an overlap occurred otherwise false.
|
||||
*/
|
||||
|
@ -169,7 +169,7 @@ var ArcadePhysics = new Class({
|
|||
* @param {(Phaser.GameObjects.GameObject|array)} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
|
||||
* @param {ArcadePhysicsCallback} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter.
|
||||
* @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`.
|
||||
* @param {object} [callbackContext] - The context in which to run the callbacks.
|
||||
* @param {*} [callbackContext] - The context in which to run the callbacks.
|
||||
*
|
||||
* @return {boolean} True if a collision occurred otherwise false.
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,25 @@ var Rectangle = require('../../geom/rectangle/Rectangle');
|
|||
var RectangleContains = require('../../geom/rectangle/Contains');
|
||||
var Vector2 = require('../../math/Vector2');
|
||||
|
||||
/**
|
||||
* @typedef {object} ArcadeBodyBounds
|
||||
*
|
||||
* @property {number} x - [description]
|
||||
* @property {number} y - [description]
|
||||
* @property {number} right - [description]
|
||||
* @property {number} bottom - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ArcadeBodyCollision
|
||||
*
|
||||
* @property {boolean} none - [description]
|
||||
* @property {boolean} up - [description]
|
||||
* @property {boolean} down - [description]
|
||||
* @property {boolean} left - [description]
|
||||
* @property {boolean} right - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* [description]
|
||||
|
@ -544,7 +563,7 @@ var Body = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#checkCollision
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.checkCollision = { none: false, up: true, down: true, left: true, right: true };
|
||||
|
@ -553,7 +572,7 @@ var Body = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#touching
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.touching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -562,7 +581,7 @@ var Body = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#wasTouching
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -571,7 +590,7 @@ var Body = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#blocked
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.blocked = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -1126,9 +1145,9 @@ var Body = new Class({
|
|||
* @method Phaser.Physics.Arcade.Body#getBounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} obj - [description]
|
||||
* @param {ArcadeBodyBounds} obj - [description]
|
||||
*
|
||||
* @return {object} [description]
|
||||
* @return {ArcadeBodyBounds} [description]
|
||||
*/
|
||||
getBounds: function (obj)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ var Factory = new Class({
|
|||
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision.
|
||||
* @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
|
||||
* @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean.
|
||||
* @param {object} callbackContext - The scope in which to call the callbacks.
|
||||
* @param {*} callbackContext - The scope in which to call the callbacks.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ var Factory = new Class({
|
|||
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap.
|
||||
* @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
|
||||
* @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean.
|
||||
* @param {object} callbackContext - The scope in which to call the callbacks.
|
||||
* @param {*} callbackContext - The scope in which to call the callbacks.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
|
||||
*/
|
||||
|
@ -196,7 +196,7 @@ var Factory = new Class({
|
|||
*
|
||||
* @param {number} x - The horizontal position of this Game Object in the world.
|
||||
* @param {number} y - The vertical position of this Game Object in the world.
|
||||
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
|
||||
* @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
|
||||
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created.
|
||||
|
@ -221,7 +221,7 @@ var Factory = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {array} [children] - [description]
|
||||
* @param {object} [config] - [description]
|
||||
* @param {GroupConfig} [config] - [description]
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.StaticGroup} The Static Group object that was created.
|
||||
*/
|
||||
|
@ -238,7 +238,7 @@ var Factory = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {array} [children] - [description]
|
||||
* @param {object} [config] - [description]
|
||||
* @param {PhysicsGroupConfig} [config] - [description]
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Group} The Group object that was created.
|
||||
*/
|
||||
|
|
|
@ -10,10 +10,57 @@ var CONST = require('./const');
|
|||
var GetFastValue = require('../../utils/object/GetFastValue');
|
||||
var Group = require('../../gameobjects/group/Group');
|
||||
|
||||
/**
|
||||
* @typedef {object} PhysicsGroupConfig
|
||||
* @extends GroupConfig
|
||||
*
|
||||
* @property {[type]} [collideWorldBounds=false] - [description]
|
||||
* @property {number} [accelerationX=0] - [description]
|
||||
* @property {number} [accelerationY=0] - [description]
|
||||
* @property {number} [bounceX=0] - [description]
|
||||
* @property {number} [bounceY=0] - [description]
|
||||
* @property {number} [dragX=0] - [description]
|
||||
* @property {number} [dragY=0] - [description]
|
||||
* @property {number} [gravityX=0] - [description]
|
||||
* @property {number} [gravityY=0] - [description]
|
||||
* @property {number} [frictionX=0] - [description]
|
||||
* @property {number} [frictionY=0] - [description]
|
||||
* @property {number} [velocityX=0] - [description]
|
||||
* @property {number} [velocityY=0] - [description]
|
||||
* @property {number} [angularVelocity=0] - [description]
|
||||
* @property {number} [angularAcceleration=0] - [description]
|
||||
* @property {number} [angularDrag=0] - [description]
|
||||
* @property {number} [mass=0] - [description]
|
||||
* @property {boolean} [immovable=false] - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} PhysicsGroupDefaults
|
||||
*
|
||||
* @property {[type]} setCollideWorldBounds - [description]
|
||||
* @property {number} setAccelerationX - [description]
|
||||
* @property {number} setAccelerationY - [description]
|
||||
* @property {number} setBounceX - [description]
|
||||
* @property {number} setBounceY - [description]
|
||||
* @property {number} setDragX - [description]
|
||||
* @property {number} setDragY - [description]
|
||||
* @property {number} setGravityX - [description]
|
||||
* @property {number} setGravityY - [description]
|
||||
* @property {number} setFrictionX - [description]
|
||||
* @property {number} setFrictionY - [description]
|
||||
* @property {number} setVelocityX - [description]
|
||||
* @property {number} setVelocityY - [description]
|
||||
* @property {number} setAngularVelocity - [description]
|
||||
* @property {number} setAngularAcceleration - [description]
|
||||
* @property {number} setAngularDrag - [description]
|
||||
* @property {number} setMass - [description]
|
||||
* @property {boolean} setImmovable - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* An Arcade Physics Group object.
|
||||
*
|
||||
*
|
||||
* All Game Objects created by this Group will automatically be dynamic Arcade Physics objects.
|
||||
*
|
||||
* @class Group
|
||||
|
@ -25,7 +72,7 @@ var Group = require('../../gameobjects/group/Group');
|
|||
* @param {Phaser.Physics.Arcade.World} world - [description]
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {array} children - [description]
|
||||
* @param {object} config - [description]
|
||||
* @param {PhysicsGroupConfig} [config] - [description]
|
||||
*/
|
||||
var PhysicsGroup = new Class({
|
||||
|
||||
|
@ -72,7 +119,7 @@ var PhysicsGroup = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Group#defaults
|
||||
* @type {object}
|
||||
* @type {PhysicsGroupDefaults}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.defaults = {
|
||||
|
|
|
@ -320,7 +320,7 @@ var StaticBody = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#checkCollision
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.checkCollision = { none: false, up: true, down: true, left: true, right: true };
|
||||
|
@ -329,7 +329,7 @@ var StaticBody = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#touching
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.touching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -338,7 +338,7 @@ var StaticBody = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#wasTouching
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -347,7 +347,7 @@ var StaticBody = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#blocked
|
||||
* @type {object}
|
||||
* @type {ArcadeBodyCollision}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.blocked = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
@ -564,9 +564,9 @@ var StaticBody = new Class({
|
|||
* @method Phaser.Physics.Arcade.StaticBody#getBounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} obj - [description]
|
||||
* @param {ArcadeBodyBounds} obj - [description]
|
||||
*
|
||||
* @return {object} [description]
|
||||
* @return {ArcadeBodyBounds} [description]
|
||||
*/
|
||||
getBounds: function (obj)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ var Group = require('../../gameobjects/group/Group');
|
|||
* @param {Phaser.Physics.Arcade.World} world - [description]
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {array} children - [description]
|
||||
* @param {object} config - [description]
|
||||
* @param {GroupConfig} config - [description]
|
||||
*/
|
||||
var StaticPhysicsGroup = new Class({
|
||||
|
||||
|
|
|
@ -27,6 +27,64 @@ var TileIntersectsBody = require('./tilemap/TileIntersectsBody');
|
|||
var Vector2 = require('../../math/Vector2');
|
||||
var Wrap = require('../../math/Wrap');
|
||||
|
||||
/**
|
||||
* @typedef {object} ArcadeWorldConfig
|
||||
*
|
||||
* @property {object} [gravity] - [description]
|
||||
* @property {number} [gravity.x=0] - [description]
|
||||
* @property {number} [gravity.y=0] - [description]
|
||||
* @property {number} [x=0] - [description]
|
||||
* @property {number} [y=0] - [description]
|
||||
* @property {number} [width=0] - [description]
|
||||
* @property {number} [height=0] - [description]
|
||||
* @property {object} [checkCollision] - [description]
|
||||
* @property {boolean} [checkCollision.up=true] - [description]
|
||||
* @property {boolean} [checkCollision.down=true] - [description]
|
||||
* @property {boolean} [checkCollision.left=true] - [description]
|
||||
* @property {boolean} [checkCollision.right=true] - [description]
|
||||
* @property {number} [overlapBias=4] - [description]
|
||||
* @property {number} [tileBias=16] - [description]
|
||||
* @property {boolean} [forceX=false] - [description]
|
||||
* @property {boolean} [isPaused=false] - [description]
|
||||
* @property {boolean} [debug=false] - [description]
|
||||
* @property {boolean} [debugShowBody=true] - [description]
|
||||
* @property {boolean} [debugShowStaticBody=true] - [description]
|
||||
* @property {boolean} [debugShowVelocity=true] - [description]
|
||||
* @property {number} [debugBodyColor=0xff00ff] - [description]
|
||||
* @property {number} [debugStaticBodyColor=0x0000ff] - [description]
|
||||
* @property {number} [debugVelocityColor=0x00ff00] - [description]
|
||||
* @property {number} [maxEntries=16] - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} CheckCollisionObject
|
||||
*
|
||||
* @property {boolean} up - [description]
|
||||
* @property {boolean} down - [description]
|
||||
* @property {boolean} left - [description]
|
||||
* @property {boolean} right - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ArcadeWorldDefaults
|
||||
*
|
||||
* @property {boolean} debugShowBody - [description]
|
||||
* @property {boolean} debugShowStaticBody - [description]
|
||||
* @property {boolean} debugShowVelocity - [description]
|
||||
* @property {number} bodyDebugColor - [description]
|
||||
* @property {number} staticBodyDebugColor - [description]
|
||||
* @property {number} velocityDebugColor - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ArcadeWorldTreeMinMax
|
||||
*
|
||||
* @property {number} minX - [description]
|
||||
* @property {number} minY - [description]
|
||||
* @property {number} maxX - [description]
|
||||
* @property {number} maxY - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* [description]
|
||||
|
@ -38,7 +96,7 @@ var Wrap = require('../../math/Wrap');
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {object} config - [description]
|
||||
* @param {ArcadeWorldConfig} config - [description]
|
||||
*/
|
||||
var World = new Class({
|
||||
|
||||
|
@ -122,7 +180,7 @@ var World = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.World#checkCollision
|
||||
* @type {object}
|
||||
* @type {CheckCollisionObject}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.checkCollision = {
|
||||
|
@ -206,7 +264,7 @@ var World = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.World#defaults
|
||||
* @type {object}
|
||||
* @type {ArcadeWorldDefaults}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.defaults = {
|
||||
|
@ -214,7 +272,7 @@ var World = new Class({
|
|||
debugShowStaticBody: GetValue(config, 'debugShowStaticBody', true),
|
||||
debugShowVelocity: GetValue(config, 'debugShowVelocity', true),
|
||||
bodyDebugColor: GetValue(config, 'debugBodyColor', 0xff00ff),
|
||||
staticBodyDebugColor: GetValue(config, 'debugBodyColor', 0x0000ff),
|
||||
staticBodyDebugColor: GetValue(config, 'debugStaticBodyColor', 0x0000ff),
|
||||
velocityDebugColor: GetValue(config, 'debugVelocityColor', 0x00ff00)
|
||||
};
|
||||
|
||||
|
@ -250,7 +308,7 @@ var World = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.World#treeMinMax
|
||||
* @type {object}
|
||||
* @type {ArcadeWorldTreeMinMax}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
||||
|
@ -567,7 +625,7 @@ var World = new Class({
|
|||
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision.
|
||||
* @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide.
|
||||
* @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean.
|
||||
* @param {object} [callbackContext] - The scope in which to call the callbacks.
|
||||
* @param {*} [callbackContext] - The scope in which to call the callbacks.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
|
||||
*/
|
||||
|
@ -594,7 +652,7 @@ var World = new Class({
|
|||
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap.
|
||||
* @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap.
|
||||
* @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean.
|
||||
* @param {object} [callbackContext] - The scope in which to call the callbacks.
|
||||
* @param {*} [callbackContext] - The scope in which to call the callbacks.
|
||||
*
|
||||
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
|
||||
*/
|
||||
|
@ -865,9 +923,9 @@ var World = new Class({
|
|||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body1 - [description]
|
||||
* @param {Phaser.Physics.Arcade.Body} body2 - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
* @param {ArcadePhysicsCallback} [processCallback] - [description]
|
||||
* @param {*} [callbackContext] - [description]
|
||||
* @param {boolean} [overlapOnly] - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
|
@ -1251,7 +1309,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.GameObject} object2 - [description]
|
||||
* @param {ArcadePhysicsCallback} [overlapCallback] - [description]
|
||||
* @param {ArcadePhysicsCallback} [processCallback] - [description]
|
||||
* @param {object} [callbackContext] - [description]
|
||||
* @param {*} [callbackContext] - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
|
@ -1274,7 +1332,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.GameObject} object2 - [description]
|
||||
* @param {ArcadePhysicsCallback} [collideCallback] - [description]
|
||||
* @param {ArcadePhysicsCallback} [processCallback] - [description]
|
||||
* @param {object} [callbackContext] - [description]
|
||||
* @param {*} [callbackContext] - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
|
@ -1297,7 +1355,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.GameObject} object2 - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1358,7 +1416,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.GameObject} object2 - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1436,7 +1494,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.GameObject} sprite2 - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1471,7 +1529,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.Group} group - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1534,7 +1592,7 @@ var World = new Class({
|
|||
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1574,7 +1632,7 @@ var World = new Class({
|
|||
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
@ -1673,7 +1731,7 @@ var World = new Class({
|
|||
* @param {Phaser.GameObjects.Group} group2 - [description]
|
||||
* @param {ArcadePhysicsCallback} collideCallback - [description]
|
||||
* @param {ArcadePhysicsCallback} processCallback - [description]
|
||||
* @param {object} callbackContext - [description]
|
||||
* @param {*} callbackContext - [description]
|
||||
* @param {boolean} overlapOnly - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
|
|
|
@ -16,6 +16,25 @@ var UpdateMotion = require('./UpdateMotion');
|
|||
* @param {Phaser.Physics.Impact.Body} body - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} JSONImpactBody
|
||||
* @todo Replace object types
|
||||
*
|
||||
* @property {string} name - [description]
|
||||
* @property {object} size - [description]
|
||||
* @property {object} pos - [description]
|
||||
* @property {object} vel - [description]
|
||||
* @property {object} accel - [description]
|
||||
* @property {object} friction - [description]
|
||||
* @property {object} maxVel - [description]
|
||||
* @property {number} gravityFactor - [description]
|
||||
* @property {number} bounciness - [description]
|
||||
* @property {number} minBounceVelocity - [description]
|
||||
* @property {Phaser.Physics.Impact.TYPE} type - [description]
|
||||
* @property {Phaser.Physics.Impact.TYPE} checkAgainst - [description]
|
||||
* @property {Phaser.Physics.Impact.COLLIDES} collides - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* An Impact.js compatible physics body.
|
||||
|
@ -490,7 +509,7 @@ var Body = new Class({
|
|||
* @method Phaser.Physics.Impact.Body#toJSON
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {object} [description]
|
||||
* @return {JSONImpactBody} [description]
|
||||
*/
|
||||
toJSON: function ()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,62 @@ var Solver = require('./Solver');
|
|||
var TILEMAP_FORMATS = require('../../tilemaps/Formats');
|
||||
var TYPE = require('./TYPE');
|
||||
|
||||
/**
|
||||
* @typedef {object} ImpactWorldConfig
|
||||
*
|
||||
* @property {number} [gravity=0] - [description]
|
||||
* @property {number} [cellSize=64] - [description]
|
||||
* @property {number} [timeScale=1] - [description]
|
||||
* @property {float} [maxStep=0.05] - [description]
|
||||
* @property {number} [gravity=0] - [description]
|
||||
* @property {boolean} [debug=false] - [description]
|
||||
* @property {number} [maxVelocity=100] - [description]
|
||||
* @property {boolean} [debugShowBody=true] - [description]
|
||||
* @property {boolean} [debugShowVelocity=true] - [description]
|
||||
* @property {number} [debugBodyColor=0xff00ff] - [description]
|
||||
* @property {number} [debugVelocityColor=0x00ff00] - [description]
|
||||
* @property {number} [maxVelocityX=maxVelocity] - [description]
|
||||
* @property {number} [maxVelocityY=maxVelocity] - [description]
|
||||
* @property {number} [minBounceVelocity=40] - [description]
|
||||
* @property {number} [gravityFactor=1] - [description]
|
||||
* @property {number} [bounciness=0] - [description]
|
||||
* @property {(object|boolean)} [setBounds] - [description]
|
||||
* @property {number} [setBounds.x=0] - [description]
|
||||
* @property {number} [setBounds.y=0] - [description]
|
||||
* @property {number} [setBounds.x=0] - [description]
|
||||
* @property {number} [setBounds.width] - [description]
|
||||
* @property {number} [setBounds.height] - [description]
|
||||
* @property {number} [setBounds.thickness=64] - [description]
|
||||
* @property {boolean} [setBounds.left=true] - [description]
|
||||
* @property {boolean} [setBounds.right=true] - [description]
|
||||
* @property {boolean} [setBounds.top=true] - [description]
|
||||
* @property {boolean} [setBounds.bottom=true] - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* An object containing the 4 wall bodies that bound the physics world.
|
||||
* @typedef {object} ImpactWorldDefaults
|
||||
*
|
||||
* @property {boolean} debugShowBody - [description]
|
||||
* @property {boolean} debugShowVelocity - [description]
|
||||
* @property {number} bodyDebugColor - [description]
|
||||
* @property {number} velocityDebugColor - [description]
|
||||
* @property {number} maxVelocityX - [description]
|
||||
* @property {number} maxVelocityY - [description]
|
||||
* @property {number} minBounceVelocity - [description]
|
||||
* @property {number} gravityFactor - [description]
|
||||
* @property {number} bounciness - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ImpactWorldWalls
|
||||
*
|
||||
* @property {?Phaser.Physics.Impact.Body} left - [description]
|
||||
* @property {?Phaser.Physics.Impact.Body} right - [description]
|
||||
* @property {?Phaser.Physics.Impact.Body} top - [description]
|
||||
* @property {?Phaser.Physics.Impact.Body} bottom - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* [description]
|
||||
|
@ -27,7 +83,7 @@ var TYPE = require('./TYPE');
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {object} config - [description]
|
||||
* @param {ImpactWorldConfig} config - [description]
|
||||
*/
|
||||
var World = new Class({
|
||||
|
||||
|
@ -140,7 +196,7 @@ var World = new Class({
|
|||
* [description]
|
||||
*
|
||||
* @name Phaser.Physics.Impact.World#defaults
|
||||
* @type {object}
|
||||
* @type {ImpactWorldDefaults}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.defaults = {
|
||||
|
@ -159,7 +215,7 @@ var World = new Class({
|
|||
* An object containing the 4 wall bodies that bound the physics world.
|
||||
*
|
||||
* @name Phaser.Physics.Impact.World#walls
|
||||
* @type {object}
|
||||
* @type {ImpactWorldWalls}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.walls = { left: null, right: null, top: null, bottom: null };
|
||||
|
|
|
@ -32,7 +32,7 @@ var Collides = {
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {CollideCallback} callback - [description]
|
||||
* @param {object} scope - [description]
|
||||
* @param {*} scope - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.GameObject} This Game Object.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue