Merge pull request #3654 from samme/docs/arcade-physics

Add docs for Arcade Physics
This commit is contained in:
Richard Davey 2018-05-10 12:00:16 +01:00 committed by GitHub
commit adcb903942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 381 additions and 296 deletions

View file

@ -229,7 +229,7 @@ var ArcadePhysics = new Class({
}, },
/** /**
* Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given speed (in pixels per second sq.) * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared)
* *
* You must give a maximum speed value, beyond which the game object won't go any faster. * You must give a maximum speed value, beyond which the game object won't go any faster.
* *
@ -242,7 +242,7 @@ var ArcadePhysics = new Class({
* @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body.
* @param {number} x - The x coordinate to accelerate towards. * @param {number} x - The x coordinate to accelerate towards.
* @param {number} y - The y coordinate to accelerate towards. * @param {number} y - The y coordinate to accelerate towards.
* @param {number} [speed=60] - The speed it will accelerate in pixels per second. * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared.
* @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach.
* @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach.
* *
@ -265,7 +265,7 @@ var ArcadePhysics = new Class({
}, },
/** /**
* Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given speed (in pixels per second sq.) * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared)
* *
* You must give a maximum speed value, beyond which the game object won't go any faster. * You must give a maximum speed value, beyond which the game object won't go any faster.
* *
@ -277,7 +277,7 @@ var ArcadePhysics = new Class({
* *
* @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body.
* @param {Phaser.GameObjects.GameObject} destination - The Game Object to move towards. Can be any object but must have visible x/y properties. * @param {Phaser.GameObjects.GameObject} destination - The Game Object to move towards. Can be any object but must have visible x/y properties.
* @param {number} [speed=60] - The speed it will accelerate in pixels per second. * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared.
* @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach.
* @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach.
* *
@ -289,7 +289,7 @@ var ArcadePhysics = new Class({
}, },
/** /**
* From a set of points or display objects, find the one closest to a source point or object. * Finds the Body closest to a source point or object.
* *
* @method Phaser.Physics.Arcade.ArcadePhysics#closest * @method Phaser.Physics.Arcade.ArcadePhysics#closest
* @since 3.0.0 * @since 3.0.0
@ -323,7 +323,7 @@ var ArcadePhysics = new Class({
}, },
/** /**
* From a set of points or display objects, find the one farthest from a source point or object. * Finds the Body farthest from a source point or object.
* *
* @method Phaser.Physics.Arcade.ArcadePhysics#furthest * @method Phaser.Physics.Arcade.ArcadePhysics#furthest
* @since 3.0.0 * @since 3.0.0
@ -417,14 +417,14 @@ var ArcadePhysics = new Class({
}, },
/** /**
* Given the angle (in degrees) and speed calculate the velocity and return it as a Point object, or set it to the given point object. * Given the angle (in degrees) and speed calculate the velocity and return it as a vector, or set it to the given vector object.
* One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object. * One way to use this is: velocityFromAngle(angle, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object.
* *
* @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromAngle * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromAngle
* @since 3.0.0 * @since 3.0.0
* *
* @param {number} angle - The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) * @param {number} angle - The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)
* @param {number} [speed=60] - The speed it will move, in pixels per second sq. * @param {number} [speed=60] - The speed it will move, in pixels per second squared.
* @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity.
* *
* @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity.
@ -438,14 +438,14 @@ var ArcadePhysics = new Class({
}, },
/** /**
* Given the rotation (in radians) and speed calculate the velocity and return it as a Point object, or set it to the given point object. * Given the rotation (in radians) and speed calculate the velocity and return it as a vector, or set it to the given vector object.
* One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object. * One way to use this is: velocityFromRotation(rotation, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object.
* *
* @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromRotation * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromRotation
* @since 3.0.0 * @since 3.0.0
* *
* @param {number} rotation - The angle in radians. * @param {number} rotation - The angle in radians.
* @param {number} [speed=60] - The speed it will move, in pixels per second sq. * @param {number} [speed=60] - The speed it will move, in pixels per second squared
* @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity.
* *
* @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity.

File diff suppressed because it is too large Load diff

View file

@ -14,30 +14,30 @@ var Group = require('../../gameobjects/group/Group');
* @typedef {object} PhysicsGroupConfig * @typedef {object} PhysicsGroupConfig
* @extends GroupConfig * @extends GroupConfig
* *
* @property {[type]} [collideWorldBounds=false] - [description] * @property {boolean} [collideWorldBounds=false] - Sets {@link Phaser.Physics.Arcade.Body#collideWorldBounds}.
* @property {number} [accelerationX=0] - [description] * @property {number} [accelerationX=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.x}.
* @property {number} [accelerationY=0] - [description] * @property {number} [accelerationY=0] - Sets {@link Phaser.Physics.Arcade.Body#acceleration acceleration.y}.
* @property {number} [bounceX=0] - [description] * @property {number} [bounceX=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.x}.
* @property {number} [bounceY=0] - [description] * @property {number} [bounceY=0] - Sets {@link Phaser.Physics.Arcade.Body#bounce bounce.y}.
* @property {number} [dragX=0] - [description] * @property {number} [dragX=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.x}.
* @property {number} [dragY=0] - [description] * @property {number} [dragY=0] - Sets {@link Phaser.Physics.Arcade.Body#drag drag.y}.
* @property {number} [gravityX=0] - [description] * @property {number} [gravityX=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.x}.
* @property {number} [gravityY=0] - [description] * @property {number} [gravityY=0] - Sets {@link Phaser.Physics.Arcade.Body#gravity gravity.y}.
* @property {number} [frictionX=0] - [description] * @property {number} [frictionX=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.x}.
* @property {number} [frictionY=0] - [description] * @property {number} [frictionY=0] - Sets {@link Phaser.Physics.Arcade.Body#friction friction.y}.
* @property {number} [velocityX=0] - [description] * @property {number} [velocityX=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.x}.
* @property {number} [velocityY=0] - [description] * @property {number} [velocityY=0] - Sets {@link Phaser.Physics.Arcade.Body#velocity velocity.y}.
* @property {number} [angularVelocity=0] - [description] * @property {number} [angularVelocity=0] - Sets {@link Phaser.Physics.Arcade.Body#angularVelocity}.
* @property {number} [angularAcceleration=0] - [description] * @property {number} [angularAcceleration=0] - Sets {@link Phaser.Physics.Arcade.Body#angularAcceleration}.
* @property {number} [angularDrag=0] - [description] * @property {number} [angularDrag=0] - Sets {@link Phaser.Physics.Arcade.Body#angularDrag}.
* @property {number} [mass=0] - [description] * @property {number} [mass=0] - Sets {@link Phaser.Physics.Arcade.Body#mass}.
* @property {boolean} [immovable=false] - [description] * @property {boolean} [immovable=false] - Sets {@link Phaser.Physics.Arcade.Body#immovable}.
*/ */
/** /**
* @typedef {object} PhysicsGroupDefaults * @typedef {object} PhysicsGroupDefaults
* *
* @property {[type]} setCollideWorldBounds - [description] * @property {boolean} setCollideWorldBounds - [description]
* @property {number} setAccelerationX - [description] * @property {number} setAccelerationX - [description]
* @property {number} setAccelerationY - [description] * @property {number} setAccelerationY - [description]
* @property {number} setBounceX - [description] * @property {number} setBounceX - [description]
@ -104,6 +104,13 @@ var PhysicsGroup = new Class({
config.createCallback = this.createCallbackHandler; config.createCallback = this.createCallbackHandler;
config.removeCallback = this.removeCallbackHandler; config.removeCallback = this.removeCallbackHandler;
/**
* The class to create new group members from.
*
* @name Phaser.Physics.Arcade.Group#classType
* @type {Phaser.Physics.Arcade.Sprite}
* @default ArcadeSprite
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite); config.classType = GetFastValue(config, 'classType', ArcadeSprite);
/** /**

View file

@ -27,33 +27,66 @@ var TileIntersectsBody = require('./tilemap/TileIntersectsBody');
var Vector2 = require('../../math/Vector2'); var Vector2 = require('../../math/Vector2');
var Wrap = require('../../math/Wrap'); var Wrap = require('../../math/Wrap');
/**
* @event Phaser.Physics.Arcade.World#pause
*/
/**
* @event Phaser.Physics.Arcade.World#resume
*/
/**
* @event Phaser.Physics.Arcade.World#collide
* @param {Phaser.GameObjects.GameObject} gameObject1
* @param {Phaser.GameObjects.GameObject} gameObject2
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2
*/
/**
* @event Phaser.Physics.Arcade.World#overlap
* @param {Phaser.GameObjects.GameObject} gameObject1
* @param {Phaser.GameObjects.GameObject} gameObject2
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1
* @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2
*/
/**
* @event Phaser.Physics.Arcade.World#worldbounds
* @param {Phaser.Physics.Arcade.Body} body
* @param {boolean} up
* @param {boolean} down
* @param {boolean} left
* @param {boolean} right
*/
/** /**
* @typedef {object} ArcadeWorldConfig * @typedef {object} ArcadeWorldConfig
* *
* @property {object} [gravity] - [description] * @property {object} [gravity] - Sets {@link Phaser.Physics.Arcade.World#gravity}.
* @property {number} [gravity.x=0] - [description] * @property {number} [gravity.x=0] - [description]
* @property {number} [gravity.y=0] - [description] * @property {number} [gravity.y=0] - [description]
* @property {number} [x=0] - [description] * @property {number} [x=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.x}.
* @property {number} [y=0] - [description] * @property {number} [y=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.y}.
* @property {number} [width=0] - [description] * @property {number} [width=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.width}.
* @property {number} [height=0] - [description] * @property {number} [height=0] - Sets {@link Phaser.Physics.Arcade.World#bounds bounds.height}.
* @property {object} [checkCollision] - [description] * @property {object} [checkCollision] - Sets {@link Phaser.Physics.Arcade.World#checkCollision}.
* @property {boolean} [checkCollision.up=true] - [description] * @property {boolean} [checkCollision.up=true] - [description]
* @property {boolean} [checkCollision.down=true] - [description] * @property {boolean} [checkCollision.down=true] - [description]
* @property {boolean} [checkCollision.left=true] - [description] * @property {boolean} [checkCollision.left=true] - [description]
* @property {boolean} [checkCollision.right=true] - [description] * @property {boolean} [checkCollision.right=true] - [description]
* @property {number} [overlapBias=4] - [description] * @property {number} [overlapBias=4] - Sets {@link Phaser.Physics.Arcade.World#OVERLAP_BIAS}.
* @property {number} [tileBias=16] - [description] * @property {number} [tileBias=16] - Sets {@link Phaser.Physics.Arcade.World#TILE_BIAS}.
* @property {boolean} [forceX=false] - [description] * @property {boolean} [forceX=false] - Sets {@link Phaser.Physics.Arcade.World#forceX}.
* @property {boolean} [isPaused=false] - [description] * @property {boolean} [isPaused=false] - Sets {@link Phaser.Physics.Arcade.World#isPaused}.
* @property {boolean} [debug=false] - [description] * @property {boolean} [debug=false] - Sets {@link Phaser.Physics.Arcade.World#debug}.
* @property {boolean} [debugShowBody=true] - [description] * @property {boolean} [debugShowBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowBody}.
* @property {boolean} [debugShowStaticBody=true] - [description] * @property {boolean} [debugShowStaticBody=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}.
* @property {boolean} [debugShowVelocity=true] - [description] * @property {boolean} [debugShowVelocity=true] - Sets {@link Phaser.Physics.Arcade.World#defaults debugShowStaticBody}.
* @property {number} [debugBodyColor=0xff00ff] - [description] * @property {number} [debugBodyColor=0xff00ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugBodyColor}.
* @property {number} [debugStaticBodyColor=0x0000ff] - [description] * @property {number} [debugStaticBodyColor=0x0000ff] - Sets {@link Phaser.Physics.Arcade.World#defaults debugStaticBodyColor}.
* @property {number} [debugVelocityColor=0x00ff00] - [description] * @property {number} [debugVelocityColor=0x00ff00] - Sets {@link Phaser.Physics.Arcade.World#defaults debugVelocityColor}.
* @property {number} [maxEntries=16] - [description] * @property {number} [maxEntries=16] - Sets {@link Phaser.Physics.Arcade.World#maxEntries}.
*/ */
/** /**
@ -109,7 +142,7 @@ var World = new Class({
EventEmitter.call(this); EventEmitter.call(this);
/** /**
* [description] * The Scene this simulation belongs to.
* *
* @name Phaser.Physics.Arcade.World#scene * @name Phaser.Physics.Arcade.World#scene
* @type {Phaser.Scene} * @type {Phaser.Scene}
@ -118,7 +151,7 @@ var World = new Class({
this.scene = scene; this.scene = scene;
/** /**
* Dynamic Bodies * Dynamic Bodies in this simulation.
* *
* @name Phaser.Physics.Arcade.World#bodies * @name Phaser.Physics.Arcade.World#bodies
* @type {Phaser.Structs.Set.<Phaser.Physics.Arcade.Body>} * @type {Phaser.Structs.Set.<Phaser.Physics.Arcade.Body>}
@ -127,7 +160,7 @@ var World = new Class({
this.bodies = new Set(); this.bodies = new Set();
/** /**
* Static Bodies * Static Bodies in this simulation.
* *
* @name Phaser.Physics.Arcade.World#staticBodies * @name Phaser.Physics.Arcade.World#staticBodies
* @type {Phaser.Structs.Set.<Phaser.Physics.Arcade.StaticBody>} * @type {Phaser.Structs.Set.<Phaser.Physics.Arcade.StaticBody>}
@ -136,7 +169,7 @@ var World = new Class({
this.staticBodies = new Set(); this.staticBodies = new Set();
/** /**
* Static Bodies * Static Bodies marked for deletion.
* *
* @name Phaser.Physics.Arcade.World#pendingDestroy * @name Phaser.Physics.Arcade.World#pendingDestroy
* @type {Phaser.Structs.Set.<(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)>} * @type {Phaser.Structs.Set.<(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)>}
@ -145,7 +178,7 @@ var World = new Class({
this.pendingDestroy = new Set(); this.pendingDestroy = new Set();
/** /**
* [description] * This simulation's collision processors.
* *
* @name Phaser.Physics.Arcade.World#colliders * @name Phaser.Physics.Arcade.World#colliders
* @type {Phaser.Structs.ProcessQueue.<Phaser.Physics.Arcade.Collider>} * @type {Phaser.Structs.ProcessQueue.<Phaser.Physics.Arcade.Collider>}
@ -154,7 +187,7 @@ var World = new Class({
this.colliders = new ProcessQueue(); this.colliders = new ProcessQueue();
/** /**
* [description] * Acceleration of Bodies due to gravity, in pixels per second.
* *
* @name Phaser.Physics.Arcade.World#gravity * @name Phaser.Physics.Arcade.World#gravity
* @type {Phaser.Math.Vector2} * @type {Phaser.Math.Vector2}
@ -163,7 +196,7 @@ var World = new Class({
this.gravity = new Vector2(GetValue(config, 'gravity.x', 0), GetValue(config, 'gravity.y', 0)); this.gravity = new Vector2(GetValue(config, 'gravity.x', 0), GetValue(config, 'gravity.y', 0));
/** /**
* [description] * A boundary constraining Bodies.
* *
* @name Phaser.Physics.Arcade.World#bounds * @name Phaser.Physics.Arcade.World#bounds
* @type {Phaser.Geom.Rectangle} * @type {Phaser.Geom.Rectangle}
@ -177,7 +210,7 @@ var World = new Class({
); );
/** /**
* [description] * The boundary edges that Bodies can collide with.
* *
* @name Phaser.Physics.Arcade.World#checkCollision * @name Phaser.Physics.Arcade.World#checkCollision
* @type {CheckCollisionObject} * @type {CheckCollisionObject}
@ -191,7 +224,9 @@ var World = new Class({
}; };
/** /**
* [description] * The maximum absolute difference of a Body's per-step velocity and its overlap with another Body that will result in separation on *each axis*.
* Larger values favor separation.
* Smaller values favor no separation.
* *
* @name Phaser.Physics.Arcade.World#OVERLAP_BIAS * @name Phaser.Physics.Arcade.World#OVERLAP_BIAS
* @type {number} * @type {number}
@ -201,7 +236,10 @@ var World = new Class({
this.OVERLAP_BIAS = GetValue(config, 'overlapBias', 4); this.OVERLAP_BIAS = GetValue(config, 'overlapBias', 4);
/** /**
* [description] * The maximum absolute value of a Body's overlap with a tile that will result in separation on *each axis*.
* Larger values favor separation.
* Smaller values favor no separation.
* The optimum value may be similar to the tile size.
* *
* @name Phaser.Physics.Arcade.World#TILE_BIAS * @name Phaser.Physics.Arcade.World#TILE_BIAS
* @type {number} * @type {number}
@ -211,7 +249,8 @@ var World = new Class({
this.TILE_BIAS = GetValue(config, 'tileBias', 16); this.TILE_BIAS = GetValue(config, 'tileBias', 16);
/** /**
* [description] * Always separate overlapping Bodies horizontally before vertically.
* False (the default) means Bodies are first separated on the axis of greater gravity, or the vertical axis if neither is greater.
* *
* @name Phaser.Physics.Arcade.World#forceX * @name Phaser.Physics.Arcade.World#forceX
* @type {boolean} * @type {boolean}
@ -221,7 +260,7 @@ var World = new Class({
this.forceX = GetValue(config, 'forceX', false); this.forceX = GetValue(config, 'forceX', false);
/** /**
* [description] * Whether the simulation advances with the game loop.
* *
* @name Phaser.Physics.Arcade.World#isPaused * @name Phaser.Physics.Arcade.World#isPaused
* @type {boolean} * @type {boolean}
@ -231,7 +270,7 @@ var World = new Class({
this.isPaused = GetValue(config, 'isPaused', false); this.isPaused = GetValue(config, 'isPaused', false);
/** /**
* [description] * Temporary total of colliding Bodies.
* *
* @name Phaser.Physics.Arcade.World#_total * @name Phaser.Physics.Arcade.World#_total
* @type {number} * @type {number}
@ -242,7 +281,7 @@ var World = new Class({
this._total = 0; this._total = 0;
/** /**
* [description] * Enables the debug display.
* *
* @name Phaser.Physics.Arcade.World#drawDebug * @name Phaser.Physics.Arcade.World#drawDebug
* @type {boolean} * @type {boolean}
@ -252,7 +291,7 @@ var World = new Class({
this.drawDebug = GetValue(config, 'debug', false); this.drawDebug = GetValue(config, 'debug', false);
/** /**
* [description] * The graphics object drawing the debug display.
* *
* @name Phaser.Physics.Arcade.World#debugGraphic * @name Phaser.Physics.Arcade.World#debugGraphic
* @type {Phaser.GameObjects.Graphics} * @type {Phaser.GameObjects.Graphics}
@ -261,7 +300,7 @@ var World = new Class({
this.debugGraphic; this.debugGraphic;
/** /**
* [description] * Default debug display settings for new Bodies.
* *
* @name Phaser.Physics.Arcade.World#defaults * @name Phaser.Physics.Arcade.World#defaults
* @type {ArcadeWorldDefaults} * @type {ArcadeWorldDefaults}
@ -277,7 +316,7 @@ var World = new Class({
}; };
/** /**
* [description] * The maximum number of items per tree node.
* *
* @name Phaser.Physics.Arcade.World#maxEntries * @name Phaser.Physics.Arcade.World#maxEntries
* @type {integer} * @type {integer}
@ -287,7 +326,7 @@ var World = new Class({
this.maxEntries = GetValue(config, 'maxEntries', 16); this.maxEntries = GetValue(config, 'maxEntries', 16);
/** /**
* [description] * The spatial index of Dynamic Bodies.
* *
* @name Phaser.Physics.Arcade.World#tree * @name Phaser.Physics.Arcade.World#tree
* @type {Phaser.Structs.RTree} * @type {Phaser.Structs.RTree}
@ -296,7 +335,7 @@ var World = new Class({
this.tree = new RTree(this.maxEntries); this.tree = new RTree(this.maxEntries);
/** /**
* [description] * The spatial index of Static Bodies.
* *
* @name Phaser.Physics.Arcade.World#staticTree * @name Phaser.Physics.Arcade.World#staticTree
* @type {Phaser.Structs.RTree} * @type {Phaser.Structs.RTree}
@ -305,7 +344,7 @@ var World = new Class({
this.staticTree = new RTree(this.maxEntries); this.staticTree = new RTree(this.maxEntries);
/** /**
* [description] * Recycled input for tree searches.
* *
* @name Phaser.Physics.Arcade.World#treeMinMax * @name Phaser.Physics.Arcade.World#treeMinMax
* @type {ArcadeWorldTreeMinMax} * @type {ArcadeWorldTreeMinMax}
@ -320,7 +359,7 @@ var World = new Class({
}, },
/** /**
* [description] * Adds an Arcade Physics Body to a Game Object.
* *
* @method Phaser.Physics.Arcade.World#enable * @method Phaser.Physics.Arcade.World#enable
* @since 3.0.0 * @since 3.0.0
@ -363,7 +402,7 @@ var World = new Class({
}, },
/** /**
* [description] * Helper for Phaser.Physics.Arcade.World#enable.
* *
* @method Phaser.Physics.Arcade.World#enableBody * @method Phaser.Physics.Arcade.World#enableBody
* @since 3.0.0 * @since 3.0.0
@ -397,7 +436,7 @@ var World = new Class({
}, },
/** /**
* [description] * Remove a Body from the simulation.
* *
* @method Phaser.Physics.Arcade.World#remove * @method Phaser.Physics.Arcade.World#remove
* @since 3.0.0 * @since 3.0.0
@ -410,7 +449,7 @@ var World = new Class({
}, },
/** /**
* [description] * Disables the Body of a Game Object, or the Bodies of several Game Objects.
* *
* @method Phaser.Physics.Arcade.World#disable * @method Phaser.Physics.Arcade.World#disable
* @since 3.0.0 * @since 3.0.0
@ -450,7 +489,7 @@ var World = new Class({
}, },
/** /**
* [description] * Disables the Body of a Game Object.
* *
* @method Phaser.Physics.Arcade.World#disableGameObjectBody * @method Phaser.Physics.Arcade.World#disableGameObjectBody
* @since 3.1.0 * @since 3.1.0
@ -480,7 +519,8 @@ var World = new Class({
}, },
/** /**
* [description] * Disables a Body.
* A disabled Body is ignored by the simulation. It doesn't move or interact with other Bodies.
* *
* @method Phaser.Physics.Arcade.World#disableBody * @method Phaser.Physics.Arcade.World#disableBody
* @since 3.0.0 * @since 3.0.0
@ -504,7 +544,7 @@ var World = new Class({
}, },
/** /**
* [description] * Creates the graphics object responsible for debug display.
* *
* @method Phaser.Physics.Arcade.World#createDebugGraphic * @method Phaser.Physics.Arcade.World#createDebugGraphic
* @since 3.0.0 * @since 3.0.0
@ -525,7 +565,7 @@ var World = new Class({
}, },
/** /**
* [description] * Sets the dimensions of the world boundary.
* *
* @method Phaser.Physics.Arcade.World#setBounds * @method Phaser.Physics.Arcade.World#setBounds
* @since 3.0.0 * @since 3.0.0
@ -554,7 +594,7 @@ var World = new Class({
}, },
/** /**
* [description] * Enables or disables collisions on each boundary edge.
* *
* @method Phaser.Physics.Arcade.World#setBoundsCollision * @method Phaser.Physics.Arcade.World#setBoundsCollision
* @since 3.0.0 * @since 3.0.0
@ -582,9 +622,10 @@ var World = new Class({
}, },
/** /**
* [description] * Pauses the simulation.
* *
* @method Phaser.Physics.Arcade.World#pause * @method Phaser.Physics.Arcade.World#pause
* @fires Phaser.Physics.Arcade.World#pause
* @since 3.0.0 * @since 3.0.0
* *
* @return {Phaser.Physics.Arcade.World} This World object. * @return {Phaser.Physics.Arcade.World} This World object.
@ -599,9 +640,10 @@ var World = new Class({
}, },
/** /**
* [description] * Resumes the simulation, if paused.
* *
* @method Phaser.Physics.Arcade.World#resume * @method Phaser.Physics.Arcade.World#resume
* @fires Phaser.Physics.Arcade.World#resume
* @since 3.0.0 * @since 3.0.0
* *
* @return {Phaser.Physics.Arcade.World} This World object. * @return {Phaser.Physics.Arcade.World} This World object.
@ -616,10 +658,11 @@ var World = new Class({
}, },
/** /**
* [description] * Adds a collision processor, which runs automatically.
* *
* @method Phaser.Physics.Arcade.World#addCollider * @method Phaser.Physics.Arcade.World#addCollider
* @since 3.0.0 * @since 3.0.0
* @see Phaser.Physics.Arcade.World#collide
* *
* @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} object1 - The first object to check for collision. * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} object1 - The first object to check for collision.
* @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} object2 - The second object to check for collision. * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} object2 - The second object to check for collision.
@ -643,7 +686,7 @@ var World = new Class({
}, },
/** /**
* [description] * Adds an overlap processor, which runs automatically.
* *
* @method Phaser.Physics.Arcade.World#addOverlap * @method Phaser.Physics.Arcade.World#addOverlap
* @since 3.0.0 * @since 3.0.0
@ -670,7 +713,7 @@ var World = new Class({
}, },
/** /**
* [description] * Removes a collision or overlap processor.
* *
* @method Phaser.Physics.Arcade.World#removeCollider * @method Phaser.Physics.Arcade.World#removeCollider
* @since 3.0.0 * @since 3.0.0
@ -687,13 +730,13 @@ var World = new Class({
}, },
/** /**
* [description] * Advances the simulation.
* *
* @method Phaser.Physics.Arcade.World#update * @method Phaser.Physics.Arcade.World#update
* @since 3.0.0 * @since 3.0.0
* *
* @param {number} time - [description] * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
* @param {number} delta - [description] * @param {number} delta - The delta time, in ms, elapsed since the last frame.
*/ */
update: function (time, delta) update: function (time, delta)
{ {
@ -743,7 +786,7 @@ var World = new Class({
}, },
/** /**
* [description] * Updates bodies, draws the debug display, and handles pending queue operations.
* *
* @method Phaser.Physics.Arcade.World#postUpdate * @method Phaser.Physics.Arcade.World#postUpdate
* @since 3.0.0 * @since 3.0.0
@ -832,7 +875,7 @@ var World = new Class({
}, },
/** /**
* [description] * Calculates a Body's velocity and updates its position.
* *
* @method Phaser.Physics.Arcade.World#updateMotion * @method Phaser.Physics.Arcade.World#updateMotion
* @since 3.0.0 * @since 3.0.0
@ -854,7 +897,7 @@ var World = new Class({
}, },
/** /**
* [description] * Calculates a Body's per-axis velocity.
* *
* @method Phaser.Physics.Arcade.World#computeVelocity * @method Phaser.Physics.Arcade.World#computeVelocity
* @since 3.0.0 * @since 3.0.0
@ -916,9 +959,11 @@ var World = new Class({
}, },
/** /**
* [description] * Separates two Bodies, when at least one is rectangular.
* *
* @method Phaser.Physics.Arcade.World#separate * @method Phaser.Physics.Arcade.World#separate
* @fires Phaser.Physics.Arcade.World#collide
* @fires Phaser.Physics.Arcade.World#overlap
* @since 3.0.0 * @since 3.0.0
* *
* @param {Phaser.Physics.Arcade.Body} body1 - [description] * @param {Phaser.Physics.Arcade.Body} body1 - [description]
@ -1023,9 +1068,11 @@ var World = new Class({
}, },
/** /**
* [description] * Separates two Bodies, when both are circular.
* *
* @method Phaser.Physics.Arcade.World#separateCircle * @method Phaser.Physics.Arcade.World#separateCircle
* @fires Phaser.Physics.Arcade.World#collide
* @fires Phaser.Physics.Arcade.World#overlap
* @since 3.0.0 * @since 3.0.0
* *
* @param {Phaser.Physics.Arcade.Body} body1 - [description] * @param {Phaser.Physics.Arcade.Body} body1 - [description]
@ -1215,7 +1262,7 @@ var World = new Class({
}, },
/** /**
* [description] * Tests of two bodies intersect (overlap).
* *
* @method Phaser.Physics.Arcade.World#intersects * @method Phaser.Physics.Arcade.World#intersects
* @since 3.0.0 * @since 3.0.0
@ -1278,7 +1325,7 @@ var World = new Class({
}, },
/** /**
* [description] * Tests if a circular Body intersects with another Body.
* *
* @method Phaser.Physics.Arcade.World#circleBodyIntersects * @method Phaser.Physics.Arcade.World#circleBodyIntersects
* @since 3.0.0 * @since 3.0.0
@ -1300,7 +1347,7 @@ var World = new Class({
}, },
/** /**
* [description] * Tests if Game Objects overlap.
* *
* @method Phaser.Physics.Arcade.World#overlap * @method Phaser.Physics.Arcade.World#overlap
* @since 3.0.0 * @since 3.0.0
@ -1311,7 +1358,7 @@ var World = new Class({
* @param {ArcadePhysicsCallback} [processCallback] - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description]
* @param {*} [callbackContext] - [description] * @param {*} [callbackContext] - [description]
* *
* @return {boolean} [description] * @return {boolean} True if at least one Game Object overlaps another.
*/ */
overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) overlap: function (object1, object2, overlapCallback, processCallback, callbackContext)
{ {
@ -1323,7 +1370,7 @@ var World = new Class({
}, },
/** /**
* [description] * Tests if Game Objects overlap and separates them (if possible).
* *
* @method Phaser.Physics.Arcade.World#collide * @method Phaser.Physics.Arcade.World#collide
* @since 3.0.0 * @since 3.0.0
@ -1334,7 +1381,7 @@ var World = new Class({
* @param {ArcadePhysicsCallback} [processCallback] - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description]
* @param {*} [callbackContext] - [description] * @param {*} [callbackContext] - [description]
* *
* @return {boolean} [description] * @return {boolean} True if any overlapping Game Objects were separated.
*/ */
collide: function (object1, object2, collideCallback, processCallback, callbackContext) collide: function (object1, object2, collideCallback, processCallback, callbackContext)
{ {
@ -1346,7 +1393,7 @@ var World = new Class({
}, },
/** /**
* [description] * Helper for Phaser.Physics.Arcade.World#collide.
* *
* @method Phaser.Physics.Arcade.World#collideObjects * @method Phaser.Physics.Arcade.World#collideObjects
* @since 3.0.0 * @since 3.0.0
@ -1358,7 +1405,7 @@ var World = new Class({
* @param {*} callbackContext - [description] * @param {*} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
* @return {boolean} [description] * @return {boolean} True if any overlapping objects were separated.
*/ */
collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly)
{ {
@ -1407,7 +1454,7 @@ var World = new Class({
}, },
/** /**
* [description] * Helper for Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap.
* *
* @method Phaser.Physics.Arcade.World#collideHandler * @method Phaser.Physics.Arcade.World#collideHandler
* @since 3.0.0 * @since 3.0.0
@ -1485,7 +1532,7 @@ var World = new Class({
}, },
/** /**
* [description] * Handler for Sprite vs. Sprite collisions.
* *
* @method Phaser.Physics.Arcade.World#collideSpriteVsSprite * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite
* @since 3.0.0 * @since 3.0.0
@ -1520,7 +1567,7 @@ var World = new Class({
}, },
/** /**
* [description] * Handler for Sprite vs. Group collisions.
* *
* @method Phaser.Physics.Arcade.World#collideSpriteVsGroup * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup
* @since 3.0.0 * @since 3.0.0
@ -1583,7 +1630,7 @@ var World = new Class({
}, },
/** /**
* [description] * Helper for Group vs. Tilemap collisions.
* *
* @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer
* @since 3.0.0 * @since 3.0.0
@ -1623,9 +1670,11 @@ var World = new Class({
}, },
/** /**
* [description] * Helper for Sprite vs. Tilemap collisions.
* *
* @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer
* @fires Phaser.Physics.Arcade.World#collide
* @fires Phaser.Physics.Arcade.World#overlap
* @since 3.0.0 * @since 3.0.0
* *
* @param {Phaser.GameObjects.GameObject} sprite - [description] * @param {Phaser.GameObjects.GameObject} sprite - [description]
@ -1722,7 +1771,7 @@ var World = new Class({
}, },
/** /**
* TODO! * Helper for Group vs. Group collisions.
* *
* @method Phaser.Physics.Arcade.World#collideGroupVsGroup * @method Phaser.Physics.Arcade.World#collideGroupVsGroup
* @since 3.0.0 * @since 3.0.0
@ -1826,7 +1875,7 @@ var World = new Class({
}, },
/** /**
* [description] * Shuts down the simulation, clearing physics data and removing listeners.
* *
* @method Phaser.Physics.Arcade.World#shutdown * @method Phaser.Physics.Arcade.World#shutdown
* @since 3.0.0 * @since 3.0.0
@ -1843,7 +1892,7 @@ var World = new Class({
}, },
/** /**
* [description] * Shuts down the simulation and disconnects it from the current scene.
* *
* @method Phaser.Physics.Arcade.World#destroy * @method Phaser.Physics.Arcade.World#destroy
* @since 3.0.0 * @since 3.0.0