Skip to content

Commit 8bb2255

Browse files
committed
Added jsdocs to Particle and Emitter. Fixed p2 UMD.
1 parent c8ca3d1 commit 8bb2255

3 files changed

Lines changed: 54 additions & 8 deletions

File tree

src/gameobjects/Particle.js

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,54 @@
77
/**
88
* @class Phaser.Particle
99
*
10-
* @classdesc Create a new `Particle` object. Particles are extended Sprites that are emitted by a particle emitter.
10+
* @classdesc Create a new `Particle` object. Particles are extended Sprites that are emitted by a particle emitter such as Phaser.Particles.Arcade.Emitter.
1111
*
1212
* @constructor
1313
* @extends Phaser.Sprite
1414
* @param {Phaser.Game} game - A reference to the currently running game.
15-
* @param {number} x - The x coordinate (in world space) to position the Sprite at.
16-
* @param {number} y - The y coordinate (in world space) to position the Sprite at.
17-
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
18-
* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
15+
* @param {number} x - The x coordinate (in world space) to position the Particle at.
16+
* @param {number} y - The y coordinate (in world space) to position the Particle at.
17+
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Particle during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
18+
* @param {string|number} frame - If this Particle is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
1919
*/
2020
Phaser.Particle = function (game, x, y, key, frame) {
2121

2222
Phaser.Sprite.call(this, game, x, y, key, frame);
2323

24+
/**
25+
* @property {boolean} autoScale - If this Particle automatically scales this is set to true by Particle.setScaleData.
26+
* @protected
27+
*/
2428
this.autoScale = false;
29+
30+
/**
31+
* @property {array} scaleData - A reference to the scaleData array owned by the Emitter that emitted this Particle.
32+
* @protected
33+
*/
2534
this.scaleData = null;
35+
36+
/**
37+
* @property {number} _s - Internal cache var for tracking auto scale.
38+
* @private
39+
*/
2640
this._s = 0;
2741

42+
/**
43+
* @property {boolean} autoAlpha - If this Particle automatically changes alpha this is set to true by Particle.setAlphaData.
44+
* @protected
45+
*/
2846
this.autoAlpha = false;
47+
48+
/**
49+
* @property {array} alphaData - A reference to the alphaData array owned by the Emitter that emitted this Particle.
50+
* @protected
51+
*/
2952
this.alphaData = null;
53+
54+
/**
55+
* @property {number} _a - Internal cache var for tracking auto alpha.
56+
* @private
57+
*/
3058
this._a = 0;
3159

3260
};
@@ -35,7 +63,7 @@ Phaser.Particle.prototype = Object.create(Phaser.Sprite.prototype);
3563
Phaser.Particle.prototype.constructor = Phaser.Particle;
3664

3765
/**
38-
* Override and use this function in your own custom objects to handle any update requirements you may have.
66+
* Updates the Particle scale or alpha if autoScale and autoAlpha are set.
3967
*
4068
* @method Phaser.Particle#update
4169
* @memberof Phaser.Particle
@@ -72,9 +100,21 @@ Phaser.Particle.prototype.update = function() {
72100

73101
};
74102

103+
/**
104+
* Called by the Emitter when this particle is emitted. Left empty for you to over-ride as required.
105+
*
106+
* @method Phaser.Particle#onEmit
107+
* @memberof Phaser.Particle
108+
*/
75109
Phaser.Particle.prototype.onEmit = function() {
76110
};
77111

112+
/**
113+
* Called by the Emitter if autoAlpha has been enabled. Passes over the alpha ease data and resets the alpha counter.
114+
*
115+
* @method Phaser.Particle#setAlphaData
116+
* @memberof Phaser.Particle
117+
*/
78118
Phaser.Particle.prototype.setAlphaData = function(data) {
79119

80120
this.alphaData = data;
@@ -84,6 +124,12 @@ Phaser.Particle.prototype.setAlphaData = function(data) {
84124

85125
};
86126

127+
/**
128+
* Called by the Emitter if autoScale has been enabled. Passes over the scale ease data and resets the scale counter.
129+
*
130+
* @method Phaser.Particle#setScaleData
131+
* @memberof Phaser.Particle
132+
*/
87133
Phaser.Particle.prototype.setScaleData = function(data) {
88134

89135
this.scaleData = data;

src/particles/arcade/Emitter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
3030
Phaser.Group.call(this, game);
3131

3232
/**
33-
* @property {string} name - Description.
33+
* @property {string} name - A handy string name for this emitter. Can be set to anything.
3434
*/
3535
this.name = 'emitter' + this.game.particles.ID++;
3636

src/physics/p2/p2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
* THE SOFTWARE.
2323
*/
24-
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.p2=e():"undefined"!=typeof global?self.p2=e():"undefined"!=typeof self&&(self.p2=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
24+
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define('p2', (function() { return this.p2 = e(); })()):"undefined"!=typeof window?window.p2=e():"undefined"!=typeof global?self.p2=e():"undefined"!=typeof self&&(self.p2=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2525
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
2626
2727
Redistribution and use in source and binary forms, with or without modification,

0 commit comments

Comments
 (0)