Skip to content

Commit a083318

Browse files
committed
Added lots of missing jsdocs
1 parent aafac3d commit a083318

22 files changed

Lines changed: 226 additions & 150 deletions

src/physics/arcade/Collider.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ var Class = require('../../utils/Class');
88

99
/**
1010
* @classdesc
11-
* The Collider class checks for collision between objects every frame
11+
* An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects
12+
* every step. If a collision, or overlap, occurs it will invoke the given callbacks.
1213
*
1314
* @class Collider
1415
* @memberof Phaser.Physics.Arcade
1516
* @constructor
1617
* @since 3.0.0
1718
*
1819
* @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions.
19-
* @param {boolean} overlapOnly - Wether to check for collisions or overlap.
20+
* @param {boolean} overlapOnly - Whether to check for collisions or overlap.
2021
* @param {ArcadeColliderType} object1 - The first object to check for collision.
2122
* @param {ArcadeColliderType} object2 - The second object to check for collision.
2223
* @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
@@ -48,7 +49,7 @@ var Collider = new Class({
4849
this.name = '';
4950

5051
/**
51-
* Wether the collider is active.
52+
* Whether the collider is active.
5253
*
5354
* @name Phaser.Physics.Arcade.Collider#active
5455
* @type {boolean}
@@ -58,7 +59,7 @@ var Collider = new Class({
5859
this.active = true;
5960

6061
/**
61-
* Wether to check for collisions or overlaps.
62+
* Whether to check for collisions or overlaps.
6263
*
6364
* @name Phaser.Physics.Arcade.Collider#overlapOnly
6465
* @type {boolean}
@@ -113,14 +114,16 @@ var Collider = new Class({
113114
},
114115

115116
/**
116-
* A name for the Collider ( currently unused internally by phaser ).
117+
* A name for the Collider.
118+
*
119+
* Phaser does not use this value, it's for your own reference.
117120
*
118121
* @method Phaser.Physics.Arcade.Collider#setName
119122
* @since 3.1.0
120123
*
121124
* @param {string} name - The name to assign to the Collider.
122125
*
123-
* @return {Phaser.Physics.Arcade.Collider} [description]
126+
* @return {Phaser.Physics.Arcade.Collider} This Collider instance.
124127
*/
125128
setName: function (name)
126129
{

src/physics/arcade/GetOverlapX.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
var CONST = require('./const');
88

99
/**
10-
* 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'.
10+
* Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties
11+
* accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'.
1112
*
1213
* @function Phaser.Physics.Arcade.GetOverlapX
1314
* @since 3.0.0
@@ -17,7 +18,7 @@ var CONST = require('./const');
1718
* @param {boolean} overlapOnly - Is this an overlap only check, or part of separation?
1819
* @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).
1920
*
20-
* @return {number} [description]
21+
* @return {number} The amount of overlap.
2122
*/
2223
var GetOverlapX = function (body1, body2, overlapOnly, bias)
2324
{

src/physics/arcade/GetOverlapY.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
var CONST = require('./const');
88

99
/**
10-
* [description]
10+
* Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties
11+
* accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'.
1112
*
1213
* @function Phaser.Physics.Arcade.GetOverlapY
1314
* @since 3.0.0
1415
*
15-
* @param {Phaser.Physics.Arcade.Body} body1 - [description]
16-
* @param {Phaser.Physics.Arcade.Body} body2 - [description]
17-
* @param {boolean} overlapOnly - [description]
18-
* @param {number} bias - [description]
16+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
17+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
18+
* @param {boolean} overlapOnly - Is this an overlap only check, or part of separation?
19+
* @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).
1920
*
20-
* @return {number} [description]
21+
* @return {number} The amount of overlap.
2122
*/
2223
var GetOverlapY = function (body1, body2, overlapOnly, bias)
2324
{

src/physics/arcade/SeparateX.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@
77
var GetOverlapX = require('./GetOverlapX');
88

99
/**
10-
* [description]
10+
* Separates two overlapping bodies on the X-axis (horizontally).
11+
*
12+
* 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.
13+
*
14+
* 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.
1115
*
1216
* @function Phaser.Physics.Arcade.SeparateX
1317
* @since 3.0.0
1418
*
15-
* @param {Phaser.Physics.Arcade.Body} body1 - [description]
16-
* @param {Phaser.Physics.Arcade.Body} body2 - [description]
17-
* @param {boolean} overlapOnly - [description]
18-
* @param {number} bias - [description]
19+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
20+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
21+
* @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place.
22+
* @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
1923
*
20-
* @return {boolean} [description]
24+
* @return {boolean} `true` if the two bodies overlap horizontally, otherwise `false`.
2125
*/
2226
var SeparateX = function (body1, body2, overlapOnly, bias)
2327
{

src/physics/arcade/SeparateY.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var GetOverlapY = require('./GetOverlapY');
2121
* @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place.
2222
* @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
2323
*
24-
* @return {boolean} `true` if the two bodies overlap vertically, `false` otherwise.
24+
* @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`.
2525
*/
2626
var SeparateY = function (body1, body2, overlapOnly, bias)
2727
{

src/physics/arcade/StaticBody.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ var StaticBody = new Class({
751751
},
752752

753753
/**
754-
* [description]
754+
* The change in this StaticBody's rotation from the previous step. Always zero.
755755
*
756756
* @method Phaser.Physics.Arcade.StaticBody#deltaZ
757757
* @since 3.0.0

0 commit comments

Comments
 (0)