Skip to content

Commit 2434bb1

Browse files
committed
Added jsdocs.
1 parent c7a84a1 commit 2434bb1

11 files changed

Lines changed: 997 additions & 31 deletions

File tree

src/physics/impact/Body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ var Body = new Class({
5959
this.enabled = true;
6060

6161
/**
62-
* [description]
62+
* The ImpactBody, ImpactSprite or ImpactImage object that owns this Body, if any.
6363
*
6464
* @name Phaser.Physics.Impact.Body#parent
65-
* @type {null}
65+
* @type {Phaser.Physics.Impact.ImpactBody|Phaser.Physics.Impact.ImpactImage|Phaser.Physics.Impact.ImpactSprite|null}
6666
* @since 3.0.0
6767
*/
6868
this.parent;

src/physics/impact/CollisionMap.js

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
// Phaser.Physics.Impact.CollisionMap
2-
31
var Class = require('../../utils/Class');
42
var DefaultDefs = require('./DefaultDefs');
53

4+
/**
5+
* @classdesc
6+
* [description]
7+
*
8+
* @class CollisionMap
9+
* @memberOf Phaser.Physics.Impact
10+
* @constructor
11+
* @since 3.0.0
12+
*
13+
* @param {integer} [tilesize=32] - [description]
14+
* @param {array} data - [description]
15+
*/
616
var CollisionMap = new Class({
717

818
initialize:
@@ -11,18 +21,78 @@ var CollisionMap = new Class({
1121
{
1222
if (tilesize === undefined) { tilesize = 32; }
1323

24+
/**
25+
* [description]
26+
*
27+
* @name Phaser.Physics.Impact.CollisionMap#tilesize
28+
* @type {integer}
29+
* @default 32
30+
* @since 3.0.0
31+
*/
1432
this.tilesize = tilesize;
1533

34+
/**
35+
* [description]
36+
*
37+
* @name Phaser.Physics.Impact.CollisionMap#data
38+
* @type {array}
39+
* @since 3.0.0
40+
*/
1641
this.data = (Array.isArray(data)) ? data : [];
1742

43+
/**
44+
* [description]
45+
*
46+
* @name Phaser.Physics.Impact.CollisionMap#width
47+
* @type {number}
48+
* @since 3.0.0
49+
*/
1850
this.width = (Array.isArray(data)) ? data[0].length : 0;
51+
52+
/**
53+
* [description]
54+
*
55+
* @name Phaser.Physics.Impact.CollisionMap#height
56+
* @type {number}
57+
* @since 3.0.0
58+
*/
1959
this.height = (Array.isArray(data)) ? data.length : 0;
2060

61+
/**
62+
* [description]
63+
*
64+
* @name Phaser.Physics.Impact.CollisionMap#lastSlope
65+
* @type {integer}
66+
* @default 55
67+
* @since 3.0.0
68+
*/
2169
this.lastSlope = 55;
2270

71+
/**
72+
* [description]
73+
*
74+
* @name Phaser.Physics.Impact.CollisionMap#tiledef
75+
* @type {object}
76+
* @since 3.0.0
77+
*/
2378
this.tiledef = DefaultDefs;
2479
},
2580

81+
/**
82+
* [description]
83+
*
84+
* @method Phaser.Physics.Impact.CollisionMap#trace
85+
* @since 3.0.0
86+
*
87+
* @param {number} x - [description]
88+
* @param {number} y - [description]
89+
* @param {number} vx - [description]
90+
* @param {number} vy - [description]
91+
* @param {number} objectWidth - [description]
92+
* @param {number} objectHeight - [description]
93+
*
94+
* @return {boolean} [description]
95+
*/
2696
trace: function (x, y, vx, vy, objectWidth, objectHeight)
2797
{
2898
// Set up the trace-result
@@ -77,6 +147,23 @@ var CollisionMap = new Class({
77147
return res;
78148
},
79149

150+
/**
151+
* [description]
152+
*
153+
* @method Phaser.Physics.Impact.CollisionMap#step
154+
* @since 3.0.0
155+
*
156+
* @param {object} res - [description]
157+
* @param {number} x - [description]
158+
* @param {number} y - [description]
159+
* @param {number} vx - [description]
160+
* @param {number} vy - [description]
161+
* @param {number} width - [description]
162+
* @param {number} height - [description]
163+
* @param {number} rvx - [description]
164+
* @param {number} rvy - [description]
165+
* @param {number} step - [description]
166+
*/
80167
step: function (res, x, y, vx, vy, width, height, rvx, rvy, step)
81168
{
82169
var t = 0;
@@ -191,6 +278,25 @@ var CollisionMap = new Class({
191278
}
192279
},
193280

281+
/**
282+
* [description]
283+
*
284+
* @method Phaser.Physics.Impact.CollisionMap#checkDef
285+
* @since 3.0.0
286+
*
287+
* @param {object} res - [description]
288+
* @param {number} t - [description]
289+
* @param {number} x - [description]
290+
* @param {number} y - [description]
291+
* @param {number} vx - [description]
292+
* @param {number} vy - [description]
293+
* @param {number} width - [description]
294+
* @param {number} height - [description]
295+
* @param {number} tileX - [description]
296+
* @param {number} tileY - [description]
297+
*
298+
* @return {boolean} [description]
299+
*/
194300
checkDef: function (res, t, x, y, vx, vy, width, height, tileX, tileY)
195301
{
196302
var def = this.tiledef[t];

src/physics/impact/Factory.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,71 @@ var ImpactBody = require('./ImpactBody');
33
var ImpactImage = require('./ImpactImage');
44
var ImpactSprite = require('./ImpactSprite');
55

6+
/**
7+
* @classdesc
8+
* The Impact Physics Factory allows you to easily create Impact Physics enabled Game Objects.
9+
* Objects that are created by this Factory are automatically added to the physics world.
10+
*
11+
* @class Factory
12+
* @memberOf Phaser.Physics.Impact
13+
* @constructor
14+
* @since 3.0.0
15+
*
16+
* @param {Phaser.Physics.Impact.World} world - [description]
17+
*/
618
var Factory = new Class({
719

820
initialize:
921

1022
function Factory (world)
1123
{
24+
/**
25+
* [description]
26+
*
27+
* @name Phaser.Physics.Impact.Factory#world
28+
* @type {Phaser.Physics.Impact.World}
29+
* @since 3.0.0
30+
*/
1231
this.world = world;
1332

33+
/**
34+
* A reference to the Scene.Systems this Impact Physics instance belongs to.
35+
*
36+
* @name Phaser.Physics.Impact.Factory#sys
37+
* @type {Phaser.Scenes.Systems}
38+
* @since 3.0.0
39+
*/
1440
this.sys = world.scene.sys;
1541
},
1642

43+
/**
44+
* [description]
45+
*
46+
* @method Phaser.Physics.Impact.Factory#body
47+
* @since 3.0.0
48+
*
49+
* @param {number} x - [description]
50+
* @param {number} y - [description]
51+
* @param {number} width - [description]
52+
* @param {number} height - [description]
53+
*
54+
* @return {Phaser.Physics.Impact.ImpactBody} The ImpactBody object that was created.
55+
*/
1756
body: function (x, y, width, height)
1857
{
1958
return new ImpactBody(this.world, x, y, width, height);
2059
},
2160

61+
/**
62+
* Adds an Impact Physics Body to the given Game Object.
63+
*
64+
* @method Phaser.Physics.Impact.Factory#existing
65+
* @since 3.0.0
66+
*
67+
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
68+
*
69+
* @return {Phaser.GameObjects.GameObject} The Game Object.
70+
*/
2271
existing: function (gameObject)
2372
{
2473
var x = gameObject.x - gameObject.frame.centerX;
@@ -34,6 +83,19 @@ var Factory = new Class({
3483
return gameObject;
3584
},
3685

86+
/**
87+
* [description]
88+
*
89+
* @method Phaser.Physics.Impact.Factory#image
90+
* @since 3.0.0
91+
*
92+
* @param {number} x - The horizontal position of this Game Object in the world.
93+
* @param {number} y - The vertical position of this Game Object in the world.
94+
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
95+
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
96+
*
97+
* @return {Phaser.Physics.Impact.ImpactImage} The ImpactImage object that was created.
98+
*/
3799
image: function (x, y, key, frame)
38100
{
39101
var image = new ImpactImage(this.world, x, y, key, frame);
@@ -43,6 +105,19 @@ var Factory = new Class({
43105
return image;
44106
},
45107

108+
/**
109+
* [description]
110+
*
111+
* @method Phaser.Physics.Impact.Factory#sprite
112+
* @since 3.0.0
113+
*
114+
* @param {number} x - The horizontal position of this Game Object in the world.
115+
* @param {number} y - The vertical position of this Game Object in the world.
116+
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
117+
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
118+
*
119+
* @return {Phaser.Physics.Impact.ImpactSprite} The ImpactSprite object that was created.
120+
*/
46121
sprite: function (x, y, key, frame)
47122
{
48123
var sprite = new ImpactSprite(this.world, x, y, key, frame);

src/physics/impact/GetVelocity.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
var Clamp = require('../../math/Clamp');
22

3+
/**
4+
* [description]
5+
*
6+
* @function Phaser.Physics.Impact.GetVelocity
7+
* @since 3.0.0
8+
*
9+
* @param {number} delta - [description]
10+
* @param {number} vel - [description]
11+
* @param {number} accel - [description]
12+
* @param {number} friction - [description]
13+
* @param {number} max - [description]
14+
*
15+
* @return {number} [description]
16+
*/
317
var GetVelocity = function (delta, vel, accel, friction, max)
418
{
519
if (accel)

0 commit comments

Comments
 (0)