Added lots of missing jsdocs

This commit is contained in:
Richard Davey 2018-10-19 17:45:05 +01:00
parent aafac3df06
commit a083318e02
22 changed files with 226 additions and 150 deletions

View file

@ -8,7 +8,8 @@ var Class = require('../../utils/Class');
/**
* @classdesc
* The Collider class checks for collision between objects every frame
* An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects
* every step. If a collision, or overlap, occurs it will invoke the given callbacks.
*
* @class Collider
* @memberof Phaser.Physics.Arcade
@ -16,7 +17,7 @@ var Class = require('../../utils/Class');
* @since 3.0.0
*
* @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions.
* @param {boolean} overlapOnly - Wether to check for collisions or overlap.
* @param {boolean} overlapOnly - Whether to check for collisions or overlap.
* @param {ArcadeColliderType} object1 - The first object to check for collision.
* @param {ArcadeColliderType} object2 - The second object to check for collision.
* @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
@ -48,7 +49,7 @@ var Collider = new Class({
this.name = '';
/**
* Wether the collider is active.
* Whether the collider is active.
*
* @name Phaser.Physics.Arcade.Collider#active
* @type {boolean}
@ -58,7 +59,7 @@ var Collider = new Class({
this.active = true;
/**
* Wether to check for collisions or overlaps.
* Whether to check for collisions or overlaps.
*
* @name Phaser.Physics.Arcade.Collider#overlapOnly
* @type {boolean}
@ -113,14 +114,16 @@ var Collider = new Class({
},
/**
* A name for the Collider ( currently unused internally by phaser ).
* A name for the Collider.
*
* Phaser does not use this value, it's for your own reference.
*
* @method Phaser.Physics.Arcade.Collider#setName
* @since 3.1.0
*
* @param {string} name - The name to assign to the Collider.
*
* @return {Phaser.Physics.Arcade.Collider} [description]
* @return {Phaser.Physics.Arcade.Collider} This Collider instance.
*/
setName: function (name)
{

View file

@ -7,7 +7,8 @@
var CONST = require('./const');
/**
* Calculates and returns the horizontal overlap between two arcade physics bodies and set their properties accordingly,including:`touching.left`,`touching.right`,`touching.none` and `overlapX'.
* Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties
* accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'.
*
* @function Phaser.Physics.Arcade.GetOverlapX
* @since 3.0.0
@ -17,7 +18,7 @@ var CONST = require('./const');
* @param {boolean} overlapOnly - Is this an overlap only check, or part of separation?
* @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).
*
* @return {number} [description]
* @return {number} The amount of overlap.
*/
var GetOverlapX = function (body1, body2, overlapOnly, bias)
{

View file

@ -7,17 +7,18 @@
var CONST = require('./const');
/**
* [description]
* Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties
* accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'.
*
* @function Phaser.Physics.Arcade.GetOverlapY
* @since 3.0.0
*
* @param {Phaser.Physics.Arcade.Body} body1 - [description]
* @param {Phaser.Physics.Arcade.Body} body2 - [description]
* @param {boolean} overlapOnly - [description]
* @param {number} bias - [description]
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
* @param {boolean} overlapOnly - Is this an overlap only check, or part of separation?
* @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).
*
* @return {number} [description]
* @return {number} The amount of overlap.
*/
var GetOverlapY = function (body1, body2, overlapOnly, bias)
{

View file

@ -7,17 +7,21 @@
var GetOverlapX = require('./GetOverlapX');
/**
* [description]
* Separates two overlapping bodies on the X-axis (horizontally).
*
* Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection.
*
* The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation.
*
* @function Phaser.Physics.Arcade.SeparateX
* @since 3.0.0
*
* @param {Phaser.Physics.Arcade.Body} body1 - [description]
* @param {Phaser.Physics.Arcade.Body} body2 - [description]
* @param {boolean} overlapOnly - [description]
* @param {number} bias - [description]
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
* @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place.
* @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
*
* @return {boolean} [description]
* @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`.
*/
var SeparateX = function (body1, body2, overlapOnly, bias)
{

View file

@ -21,7 +21,7 @@ var GetOverlapY = require('./GetOverlapY');
* @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place.
* @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
*
* @return {boolean} `true` if the two bodies overlap vertically, `false` otherwise.
* @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`.
*/
var SeparateY = function (body1, body2, overlapOnly, bias)
{

View file

@ -751,7 +751,7 @@ var StaticBody = new Class({
},
/**
* [description]
* The change in this StaticBody's rotation from the previous step. Always zero.
*
* @method Phaser.Physics.Arcade.StaticBody#deltaZ
* @since 3.0.0

View file

@ -99,30 +99,30 @@ var Wrap = require('../../math/Wrap');
/**
* @typedef {object} CheckCollisionObject
*
* @property {boolean} up - [description]
* @property {boolean} down - [description]
* @property {boolean} left - [description]
* @property {boolean} right - [description]
* @property {boolean} up - Will bodies collide with the top side of the world bounds?
* @property {boolean} down - Will bodies collide with the bottom side of the world bounds?
* @property {boolean} left - Will bodies collide with the left side of the world bounds?
* @property {boolean} right - Will bodies collide with the right side of the world bounds?
*/
/**
* @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]
* @property {boolean} debugShowBody - Set to `true` to render dynamic body outlines to the debug display.
* @property {boolean} debugShowStaticBody - Set to `true` to render static body outlines to the debug display.
* @property {boolean} debugShowVelocity - Set to `true` to render body velocity markers to the debug display.
* @property {number} bodyDebugColor - The color of dynamic body outlines when rendered to the debug display.
* @property {number} staticBodyDebugColor - The color of static body outlines when rendered to the debug display.
* @property {number} velocityDebugColor - The color of the velocity markers when rendered to the debug display.
*/
/**
* @typedef {object} ArcadeWorldTreeMinMax
*
* @property {number} minX - [description]
* @property {number} minY - [description]
* @property {number} maxX - [description]
* @property {number} maxY - [description]
* @property {number} minX - The minimum x value used in RTree searches.
* @property {number} minY - The minimum y value used in RTree searches.
* @property {number} maxX - The maximum x value used in RTree searches.
* @property {number} maxY - The maximum y value used in RTree searches.
*/
/**
@ -1790,9 +1790,9 @@ var World = new Class({
* @param {ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`.
* @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} [processCallback] - An optional 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 {*} [callbackContext] - The context in which to run the callbacks.
* @param {any} [callbackContext] - The context in which to run the callbacks.
*
* @return {boolean} True if any overlapping Game Objects were separated, otherwise false.
* @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`.
*/
collide: function (object1, object2, collideCallback, processCallback, callbackContext)
{
@ -1804,16 +1804,17 @@ var World = new Class({
},
/**
* Helper for Phaser.Physics.Arcade.World#collide.
* Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideObjects
* @private
* @since 3.0.0
*
* @param {ArcadeColliderType} object1 - [description]
* @param {ArcadeColliderType} [object2] - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {ArcadeColliderType} object1 - The first object to check for collision.
* @param {ArcadeColliderType} 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 {any} callbackContext - The scope in which to call the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
@ -1874,16 +1875,17 @@ var World = new Class({
},
/**
* Helper for Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap.
* Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead.
*
* @method Phaser.Physics.Arcade.World#collideHandler
* @private
* @since 3.0.0
*
* @param {ArcadeColliderType} object1 - [description]
* @param {ArcadeColliderType} [object2] - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {ArcadeColliderType} object1 - The first object or array of objects to check.
* @param {ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`.
* @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} processCallback - An optional 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 {any} callbackContext - The context in which to run the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
@ -1952,19 +1954,21 @@ var World = new Class({
},
/**
* Handler for Sprite vs. Sprite collisions.
* Internal handler for Sprite vs. Sprite collisions.
* Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideSpriteVsSprite
* @private
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} sprite1 - [description]
* @param {Phaser.GameObjects.GameObject} sprite2 - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision.
* @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision.
* @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} [processCallback] - An optional 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 {any} [callbackContext] - The context in which to run the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} [description]
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
*/
collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly)
{
@ -1987,16 +1991,18 @@ var World = new Class({
},
/**
* Handler for Sprite vs. Group collisions.
* Internal handler for Sprite vs. Group collisions.
* Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideSpriteVsGroup
* @private
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} sprite - [description]
* @param {Phaser.GameObjects.Group} group - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision.
* @param {Phaser.GameObjects.Group} group - 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 {any} callbackContext - The scope in which to call the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`.
@ -2080,19 +2086,21 @@ var World = new Class({
},
/**
* Helper for Group vs. Tilemap collisions.
* Internal handler for Group vs. Tilemap collisions.
* Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer
* @private
* @since 3.0.0
*
* @param {Phaser.GameObjects.Group} group - [description]
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {Phaser.GameObjects.Group} group - The first object to check for collision.
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision.
* @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} [processCallback] - An optional 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 {any} [callbackContext] - The context in which to run the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} [description]
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
*/
collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly)
{
@ -2120,21 +2128,22 @@ var World = new Class({
},
/**
* Helper for Sprite vs. Tilemap collisions.
* Internal handler for Sprite vs. Tilemap collisions.
* Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer
* @fires Phaser.Physics.Arcade.World#collide
* @fires Phaser.Physics.Arcade.World#overlap
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} sprite - [description]
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision.
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The second object to check for collision.
* @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} [processCallback] - An optional 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 {any} [callbackContext] - The context in which to run the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} [description]
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
*/
collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly)
{
@ -2224,19 +2233,21 @@ var World = new Class({
},
/**
* Helper for Group vs. Group collisions.
* Internal helper for Group vs. Group collisions.
* Please use Phaser.Physics.Arcade.World#collide instead.
*
* @method Phaser.Physics.Arcade.World#collideGroupVsGroup
* @private
* @since 3.0.0
*
* @param {Phaser.GameObjects.Group} group1 - [description]
* @param {Phaser.GameObjects.Group} group2 - [description]
* @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {ArcadePhysicsCallback} processCallback - [description]
* @param {*} callbackContext - [description]
* @param {Phaser.GameObjects.Group} group1 - The first object to check for collision.
* @param {Phaser.GameObjects.Group} group2 - The second object to check for collision.
* @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide.
* @param {ArcadePhysicsCallback} [processCallback] - An optional 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 {any} [callbackContext] - The context in which to run the callbacks.
* @param {boolean} overlapOnly - Whether this is a collision or overlap check.
*
* @return {boolean} [description]
* @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated.
*/
collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly)
{

View file

@ -5,7 +5,7 @@
*/
/**
* Provides methods used for setting the acceleration properties of an Arcade Body.
* Provides methods used for setting the acceleration properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Acceleration
* @since 3.0.0

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the angular acceleration properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Angular
* @since 3.0.0
@ -13,12 +13,16 @@
var Angular = {
/**
* [description]
* Sets the angular velocity of the body.
*
* In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
* However, they can have angular motion, which is passed on to the Game Object bound to the body,
* causing them to visually rotate, even though the body remains axis-aligned.
*
* @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of angular velocity.
*
* @return {this} This Game Object.
*/
@ -30,12 +34,16 @@ var Angular = {
},
/**
* [description]
* Sets the angular acceleration of the body.
*
* In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
* However, they can have angular motion, which is passed on to the Game Object bound to the body,
* causing them to visually rotate, even though the body remains axis-aligned.
*
* @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of angular acceleration.
*
* @return {this} This Game Object.
*/
@ -47,12 +55,12 @@ var Angular = {
},
/**
* [description]
* Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration.
*
* @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of drag.
*
* @return {this} This Game Object.
*/

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the bounce properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Bounce
* @since 3.0.0
@ -13,13 +13,16 @@
var Bounce = {
/**
* [description]
* Sets the bounce values of this body.
*
* Bounce is the amount of restitution, or elasticity, the body has when it collides with another object.
* A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all.
*
* @method Phaser.Physics.Arcade.Components.Bounce#setBounce
* @since 3.0.0
*
* @param {number} x - [description]
* @param {number} [y=x] - [description]
* @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
* @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1.
*
* @return {this} This Game Object.
*/
@ -31,12 +34,12 @@ var Bounce = {
},
/**
* [description]
* Sets the horizontal bounce value for this body.
*
* @method Phaser.Physics.Arcade.Components.Bounce#setBounceX
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
*
* @return {this} This Game Object.
*/
@ -48,12 +51,12 @@ var Bounce = {
},
/**
* [description]
* Sets the vertical bounce value for this body.
*
* @method Phaser.Physics.Arcade.Components.Bounce#setBounceY
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1.
*
* @return {this} This Game Object.
*/
@ -65,12 +68,12 @@ var Bounce = {
},
/**
* [description]
* Sets if this body should collide with the world bounds or not.
*
* @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds
* @since 3.0.0
*
* @param {boolean} value - [description]
* @param {boolean} value - `true` if this body should collide with the world bounds, otherwise `false`.
*
* @return {this} This Game Object.
*/

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the debug properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Debug
* @since 3.0.0
@ -13,14 +13,17 @@
var Debug = {
/**
* [description]
* Sets the debug values of this body.
*
* Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole.
* Note that there is a performance cost in drawing debug displays. It should never be used in production.
*
* @method Phaser.Physics.Arcade.Components.Debug#setDebug
* @since 3.0.0
*
* @param {boolean} showBody - [description]
* @param {boolean} showVelocity - [description]
* @param {number} bodyColor - [description]
* @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display.
* @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display.
* @param {number} bodyColor - The color of the body outline when rendered to the debug display.
*
* @return {this} This Game Object.
*/
@ -34,12 +37,12 @@ var Debug = {
},
/**
* [description]
* Sets the color of the body outline when it renders to the debug display.
*
* @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The color of the body outline when rendered to the debug display.
*
* @return {this} This Game Object.
*/
@ -51,7 +54,7 @@ var Debug = {
},
/**
* [description]
* Set to `true` to have this body render its outline to the debug display.
*
* @name Phaser.Physics.Arcade.Components.Debug#debugShowBody
* @type {boolean}
@ -72,7 +75,7 @@ var Debug = {
},
/**
* [description]
* Set to `true` to have this body render a velocity marker to the debug display.
*
* @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity
* @type {boolean}
@ -93,7 +96,7 @@ var Debug = {
},
/**
* [description]
* The color of the body outline when it renders to the debug display.
*
* @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor
* @type {number}

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the drag properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Drag
* @since 3.0.0
@ -13,13 +13,24 @@
var Drag = {
/**
* [description]
* Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag.
*
* Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
* It is the absolute loss of velocity due to movement, in pixels per second squared.
* The x and y components are applied separately.
*
* When `useDamping` is true, this is 1 minus the damping factor.
* A value of 1 means the Body loses no velocity.
* A value of 0.95 means the Body loses 5% of its velocity per step.
* A value of 0.5 means the Body loses 50% of its velocity per step.
*
* Drag is applied only when `acceleration` is zero.
*
* @method Phaser.Physics.Arcade.Components.Drag#setDrag
* @since 3.0.0
*
* @param {number} x - [description]
* @param {number} [y=x] - [description]
* @param {number} x - The amount of horizontal drag to apply.
* @param {number} [y=x] - The amount of vertical drag to apply.
*
* @return {this} This Game Object.
*/
@ -31,12 +42,23 @@ var Drag = {
},
/**
* [description]
* Sets the body's horizontal drag.
*
* Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
* It is the absolute loss of velocity due to movement, in pixels per second squared.
* The x and y components are applied separately.
*
* When `useDamping` is true, this is 1 minus the damping factor.
* A value of 1 means the Body loses no velocity.
* A value of 0.95 means the Body loses 5% of its velocity per step.
* A value of 0.5 means the Body loses 50% of its velocity per step.
*
* Drag is applied only when `acceleration` is zero.
*
* @method Phaser.Physics.Arcade.Components.Drag#setDragX
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of horizontal drag to apply.
*
* @return {this} This Game Object.
*/
@ -48,12 +70,23 @@ var Drag = {
},
/**
* [description]
* Sets the body's vertical drag.
*
* Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
* It is the absolute loss of velocity due to movement, in pixels per second squared.
* The x and y components are applied separately.
*
* When `useDamping` is true, this is 1 minus the damping factor.
* A value of 1 means the Body loses no velocity.
* A value of 0.95 means the Body loses 5% of its velocity per step.
* A value of 0.5 means the Body loses 50% of its velocity per step.
*
* Drag is applied only when `acceleration` is zero.
*
* @method Phaser.Physics.Arcade.Components.Drag#setDragY
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The amount of vertical drag to apply.
*
* @return {this} This Game Object.
*/
@ -65,7 +98,15 @@ var Drag = {
},
/**
* [description]
* If this Body is using `drag` for deceleration this function controls how the drag is applied.
* If set to `true` drag will use a damping effect rather than a linear approach. If you are
* creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in
* the game Asteroids) then you will get a far smoother and more visually correct deceleration
* by using damping, avoiding the axis-drift that is prone with linear deceleration.
*
* If you enable this property then you should use far smaller `drag` values than with linear, as
* they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow
* deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.
*
* @method Phaser.Physics.Arcade.Components.Drag#setDamping
* @since 3.10.0

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the enable properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Enable
* @since 3.0.0

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the immovable properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Immovable
* @since 3.0.0
@ -13,12 +13,12 @@
var Immovable = {
/**
* [description]
* Sets Whether this Body can be moved by collisions with another Body.
*
* @method Phaser.Physics.Arcade.Components.Immovable#setImmovable
* @since 3.0.0
*
* @param {boolean} [value=true] - [description]
* @param {boolean} [value=true] - Sets if this body can be moved by collisions with another Body.
*
* @return {this} This Game Object.
*/

View file

@ -5,7 +5,7 @@
*/
/**
* [description]
* Provides methods used for setting the mass properties of an Arcade Physics Body.
*
* @name Phaser.Physics.Arcade.Components.Mass
* @since 3.0.0

View file

@ -39,7 +39,7 @@ var CONST = {
STATIC_BODY: 1,
/**
* [description]
* Arcade Physics Group containing Dynamic Bodies.
*
* @name Phaser.Physics.Arcade.GROUP
* @readonly
@ -49,7 +49,7 @@ var CONST = {
GROUP: 2,
/**
* [description]
* A Tilemap Layer.
*
* @name Phaser.Physics.Arcade.TILEMAPLAYER
* @readonly

View file

@ -10,8 +10,8 @@ var Extend = require('../../utils/object/Extend');
/**
* @callback ArcadePhysicsCallback
*
* @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description]
* @param {Phaser.GameObjects.GameObject} object1 - The first Body to separate.
* @param {Phaser.GameObjects.GameObject} object2 - The second Body to separate.
*/
/**

View file

@ -5,19 +5,19 @@
*/
/**
* [description]
* A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object.
*
* @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks
* @since 3.0.0
*
* @param {Phaser.Tilemaps.Tilemap} tile - [description]
* @param {Phaser.GameObjects.Sprite} sprite - [description]
* @param {Phaser.Tilemaps.Tile} tile - The Tile to process.
* @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile.
*
* @return {boolean} [description]
* @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair.
*/
var ProcessTileCallbacks = function (tile, sprite)
{
// Tile callbacks take priority over layer level callbacks
// Tile callbacks take priority over layer level callbacks
if (tile.collisionCallback)
{
return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile);

View file

@ -14,14 +14,14 @@ var TileIntersectsBody = require('./TileIntersectsBody');
* @function Phaser.Physics.Arcade.Tilemap.SeparateTile
* @since 3.0.0
*
* @param {number} i - [description]
* @param {number} i - The index of the tile within the map data.
* @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
* @param {Phaser.Tilemaps.Tile} tile - The tile to collide against.
* @param {Phaser.Geom.Rectangle} tileWorldRect - [description]
* @param {(Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} tilemapLayer - The tilemapLayer to collide against.
* @param {number} tileBias - [description]
* @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant.
*
* @return {boolean} Returns true if the body was separated, otherwise false.
* @return {boolean} `true` if the body was separated, otherwise `false`.
*/
var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias)
{

View file

@ -8,15 +8,16 @@ var ProcessTileSeparationX = require('./ProcessTileSeparationX');
/**
* Check the body against the given tile on the X axis.
* Used internally by the SeparateTile function.
*
* @function Phaser.Physics.Arcade.Tilemap.TileCheckX
* @since 3.0.0
*
* @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
* @param {Phaser.Tilemaps.Tile} tile - The tile to check.
* @param {number} tileLeft - [description]
* @param {number} tileRight - [description]
* @param {number} tileBias - [description]
* @param {number} tileLeft - The left position of the tile within the tile world.
* @param {number} tileRight - The right position of the tile within the tile world.
* @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant.
*
* @return {number} The amount of separation that occurred.
*/

View file

@ -8,15 +8,16 @@ var ProcessTileSeparationY = require('./ProcessTileSeparationY');
/**
* Check the body against the given tile on the Y axis.
* Used internally by the SeparateTile function.
*
* @function Phaser.Physics.Arcade.Tilemap.TileCheckY
* @since 3.0.0
*
* @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
* @param {Phaser.Tilemaps.Tile} tile - The tile to check.
* @param {number} tileTop - [description]
* @param {number} tileBottom - [description]
* @param {number} tileBias - [description]
* @param {number} tileTop - The top position of the tile within the tile world.
* @param {number} tileBottom - The bottom position of the tile within the tile world.
* @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant.
*
* @return {number} The amount of separation that occurred.
*/

View file

@ -5,20 +5,19 @@
*/
/**
* [description]
* Checks for intersection between the given tile rectangle-like object and an Arcade Physics body.
*
* @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody
* @since 3.0.0
*
* @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - [description]
* @param {Phaser.Physics.Arcade.Body} body - [description]
* @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world.
* @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against.
*
* @return {boolean} [description]
* @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`.
*/
var TileIntersectsBody = function (tileWorldRect, body)
{
// Currently, all bodies are treated as rectangles when colliding with a Tile. Eventually, this
// should support circle bodies when those are less buggy in v3.
// Currently, all bodies are treated as rectangles when colliding with a Tile.
return !(
body.right <= tileWorldRect.left ||