mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Updated doc files.
This commit is contained in:
+107
-154
@@ -90,6 +90,10 @@
|
||||
<a href="Phaser.Device.html">Device</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.DOMSprite.html">DOMSprite</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Easing.html">Easing</a>
|
||||
</li>
|
||||
@@ -162,6 +166,14 @@
|
||||
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Graphics.html">Graphics</a>
|
||||
</li>
|
||||
@@ -186,6 +198,10 @@
|
||||
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Line.html">Line</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||
</li>
|
||||
@@ -278,6 +294,10 @@
|
||||
<a href="Phaser.Signal.html">Signal</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Sound.html">Sound</a>
|
||||
</li>
|
||||
@@ -342,6 +362,10 @@
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -374,36 +398,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||
class="caret"></b></a>
|
||||
|
||||
<ul class="dropdown-menu ">
|
||||
|
||||
<li>
|
||||
<a href="global.html#bottom">bottom</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -423,7 +417,7 @@
|
||||
<article>
|
||||
<pre class="sunlight-highlight-javascript linenums">/**
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @copyright 2014 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
@@ -445,7 +439,6 @@
|
||||
Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
|
||||
|
||||
/**
|
||||
* The total number of particles in this emitter.
|
||||
* @property {number} maxParticles - The total number of particles in this emitter..
|
||||
* @default
|
||||
*/
|
||||
@@ -459,7 +452,8 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
|
||||
this.name = 'emitter' + this.game.particles.ID++;
|
||||
|
||||
/**
|
||||
* @property {Description} type - Description.
|
||||
* @property {number} type - Internal Phaser Type value.
|
||||
* @protected
|
||||
*/
|
||||
this.type = Phaser.EMITTER;
|
||||
|
||||
@@ -488,140 +482,114 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
|
||||
this.height = 1;
|
||||
|
||||
/**
|
||||
* The minimum possible velocity of a particle.
|
||||
* The default value is (-100,-100).
|
||||
* @property {Phaser.Point} minParticleSpeed
|
||||
* @property {Phaser.Point} minParticleSpeed - The minimum possible velocity of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.minParticleSpeed = new Phaser.Point(-100, -100);
|
||||
|
||||
/**
|
||||
* The maximum possible velocity of a particle.
|
||||
* The default value is (100,100).
|
||||
* @property {Phaser.Point} maxParticleSpeed
|
||||
* @property {Phaser.Point} maxParticleSpeed - The maximum possible velocity of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.maxParticleSpeed = new Phaser.Point(100, 100);
|
||||
|
||||
/**
|
||||
* The minimum possible scale of a particle.
|
||||
* The default value is 1.
|
||||
* @property {number} minParticleScale
|
||||
* @property {number} minParticleScale - The minimum possible scale of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.minParticleScale = 1;
|
||||
|
||||
/**
|
||||
* The maximum possible scale of a particle.
|
||||
* The default value is 1.
|
||||
* @property {number} maxParticleScale
|
||||
* @property {number} maxParticleScale - The maximum possible scale of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.maxParticleScale = 1;
|
||||
|
||||
/**
|
||||
* The minimum possible angular velocity of a particle. The default value is -360.
|
||||
* @property {number} minRotation
|
||||
* @property {number} minRotation - The minimum possible angular velocity of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.minRotation = -360;
|
||||
|
||||
/**
|
||||
* The maximum possible angular velocity of a particle. The default value is 360.
|
||||
* @property {number} maxRotation
|
||||
* @property {number} maxRotation - The maximum possible angular velocity of a particle.
|
||||
* @default
|
||||
*/
|
||||
this.maxRotation = 360;
|
||||
|
||||
/**
|
||||
* Sets the <code>gravity.y</code> of each particle to this value on launch.
|
||||
* @property {number} gravity
|
||||
* @property {number} gravity - Sets the `body.gravity.y` of each particle sprite to this value on launch.
|
||||
* @default
|
||||
*/
|
||||
this.gravity = 2;
|
||||
this.gravity = 100;
|
||||
|
||||
/**
|
||||
* Set your own particle class type here.
|
||||
* @property {Description} particleClass
|
||||
* @property {any} particleClass - For emitting your own particle class types.
|
||||
* @default
|
||||
*/
|
||||
this.particleClass = null;
|
||||
|
||||
/**
|
||||
* The X and Y drag component of particles launched from the emitter.
|
||||
* @property {Phaser.Point} particleDrag
|
||||
* @property {number} particleFriction - The friction component of particles launched from the emitter.
|
||||
* @default
|
||||
*/
|
||||
this.particleDrag = new Phaser.Point();
|
||||
this.particleFriction = 0;
|
||||
|
||||
/**
|
||||
* The angular drag component of particles launched from the emitter if they are rotating.
|
||||
* @property {number} angularDrag
|
||||
* @property {number} angularDrag - The angular drag component of particles launched from the emitter if they are rotating.
|
||||
* @default
|
||||
*/
|
||||
this.angularDrag = 0;
|
||||
|
||||
/**
|
||||
* How often a particle is emitted in ms (if emitter is started with Explode === false).
|
||||
* @property {boolean} frequency
|
||||
* @property {boolean} frequency - How often a particle is emitted in ms (if emitter is started with Explode === false).
|
||||
* @default
|
||||
*/
|
||||
this.frequency = 100;
|
||||
|
||||
/**
|
||||
* How long each particle lives once it is emitted in ms. Default is 2 seconds.
|
||||
* Set lifespan to 'zero' for particles to live forever.
|
||||
* @property {number} lifespan
|
||||
* @property {number} lifespan - How long each particle lives once it is emitted in ms. Default is 2 seconds. Set lifespan to 'zero' for particles to live forever.
|
||||
* @default
|
||||
*/
|
||||
this.lifespan = 2000;
|
||||
|
||||
/**
|
||||
* How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
|
||||
* @property {Phaser.Point} bounce
|
||||
* @property {Phaser.Point} bounce - How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
|
||||
*/
|
||||
this.bounce = new Phaser.Point();
|
||||
|
||||
/**
|
||||
* Internal helper for deciding how many particles to launch.
|
||||
* @property {number} _quantity
|
||||
* @property {number} _quantity - Internal helper for deciding how many particles to launch.
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._quantity = 0;
|
||||
|
||||
/**
|
||||
* Internal helper for deciding when to launch particles or kill them.
|
||||
* @property {number} _timer
|
||||
* @property {number} _timer - Internal helper for deciding when to launch particles or kill them.
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._timer = 0;
|
||||
|
||||
/**
|
||||
* Internal counter for figuring out how many particles to launch.
|
||||
* @property {number} _counter
|
||||
* @property {number} _counter - Internal counter for figuring out how many particles to launch.
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._counter = 0;
|
||||
|
||||
/**
|
||||
* Internal helper for the style of particle emission (all at once, or one at a time).
|
||||
* @property {boolean} _explode
|
||||
* @property {boolean} _explode - Internal helper for the style of particle emission (all at once, or one at a time).
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._explode = true;
|
||||
|
||||
/**
|
||||
* Determines whether the emitter is currently emitting particles.
|
||||
* It is totally safe to directly toggle this.
|
||||
* @property {boolean} on
|
||||
* @property {boolean} on - Determines whether the emitter is currently emitting particles. It is totally safe to directly toggle this.
|
||||
* @default
|
||||
*/
|
||||
this.on = false;
|
||||
|
||||
/**
|
||||
* Determines whether the emitter is being updated by the core game loop.
|
||||
* @property {boolean} exists
|
||||
* @property {boolean} exists - Determines whether the emitter is being updated by the core game loop.
|
||||
* @default
|
||||
*/
|
||||
this.exists = true;
|
||||
@@ -695,43 +663,35 @@ Phaser.Particles.Arcade.Emitter.prototype.update = function () {
|
||||
* This function generates a new array of particle sprites to attach to the emitter.
|
||||
*
|
||||
* @method Phaser.Particles.Arcade.Emitter#makeParticles
|
||||
* @param {Description} keys - Description.
|
||||
* @param {number} frames - Description.
|
||||
* @param {number} quantity - The number of particles to generate when using the "create from image" option.
|
||||
* @param {number} collide - Description.
|
||||
* @param {boolean} collideWorldBounds - Description.
|
||||
* @return This Emitter instance (nice for chaining stuff together, if you're into that).
|
||||
* @param {array|string} keys - A string or an array of strings that the particle sprites will use as their texture. If an array one is picked at random.
|
||||
* @param {array|number} frames - A frame number, or array of frames that the sprite will use. If an array one is picked at random.
|
||||
* @param {number} quantity - The number of particles to generate.
|
||||
* @param {boolean} [collide=false] - Sets the checkCollision.none flag on the particle sprites body.
|
||||
* @param {boolean} [collideWorldBounds=false] - A particle can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
|
||||
* @return {Phaser.Particles.Arcade.Emitter} This Emitter instance.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames, quantity, collide, collideWorldBounds) {
|
||||
|
||||
if (typeof frames == 'undefined')
|
||||
{
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
quantity = quantity || this.maxParticles;
|
||||
collide = collide || 0;
|
||||
|
||||
if (typeof collideWorldBounds == 'undefined')
|
||||
{
|
||||
collideWorldBounds = false;
|
||||
}
|
||||
if (typeof frames === 'undefined') { frames = 0; }
|
||||
if (typeof quantity === 'undefined') { quantity = this.maxParticles; }
|
||||
if (typeof collide === 'undefined') { collide = false; }
|
||||
if (typeof collideWorldBounds === 'undefined') { collideWorldBounds = false; }
|
||||
|
||||
var particle;
|
||||
var i = 0;
|
||||
var rndKey = keys;
|
||||
var rndFrame = 0;
|
||||
var rndFrame = frames;
|
||||
|
||||
while (i < quantity)
|
||||
{
|
||||
if (this.particleClass == null)
|
||||
if (this.particleClass === null)
|
||||
{
|
||||
if (typeof keys == 'object')
|
||||
if (typeof keys === 'object')
|
||||
{
|
||||
rndKey = this.game.rnd.pick(keys);
|
||||
}
|
||||
|
||||
if (typeof frames == 'object')
|
||||
if (typeof frames === 'object')
|
||||
{
|
||||
rndFrame = this.game.rnd.pick(frames);
|
||||
}
|
||||
@@ -743,14 +703,14 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
|
||||
// particle = new this.particleClass(this.game);
|
||||
// }
|
||||
|
||||
if (collide > 0)
|
||||
if (collide)
|
||||
{
|
||||
particle.body.allowCollision.any = true;
|
||||
particle.body.allowCollision.none = false;
|
||||
particle.body.checkCollision.any = true;
|
||||
particle.body.checkCollision.none = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
particle.body.allowCollision.none = true;
|
||||
particle.body.checkCollision.none = true;
|
||||
}
|
||||
|
||||
particle.body.collideWorldBounds = collideWorldBounds;
|
||||
@@ -770,9 +730,9 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this function to turn off all the particles and the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#kill
|
||||
*/
|
||||
* Call this function to turn off all the particles and the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#kill
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
|
||||
|
||||
this.on = false;
|
||||
@@ -782,10 +742,9 @@ Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handy for bringing game objects "back to life". Just sets alive and exists back to true.
|
||||
* In practice, this is most often called by <code>Object.reset()</code>.
|
||||
* @method Phaser.Particles.Arcade.Emitter#revive
|
||||
*/
|
||||
* Handy for bringing game objects "back to life". Just sets alive and exists back to true.
|
||||
* @method Phaser.Particles.Arcade.Emitter#revive
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
|
||||
|
||||
this.alive = true;
|
||||
@@ -794,27 +753,19 @@ Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this function to start emitting particles.
|
||||
* @method Phaser.Particles.Arcade.Emitter#start
|
||||
* @param {boolean} explode - Whether the particles should all burst out at once.
|
||||
* @param {number} lifespan - How long each particle lives once emitted. 0 = forever.
|
||||
* @param {number} frequency - Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
|
||||
* @param {number} quantity - How many particles to launch. 0 = "all of the particles".
|
||||
*/
|
||||
* Call this function to start emitting particles.
|
||||
* @method Phaser.Particles.Arcade.Emitter#start
|
||||
* @param {boolean} [explode=true] - Whether the particles should all burst out at once.
|
||||
* @param {number} [lifespan=0] - How long each particle lives once emitted. 0 = forever.
|
||||
* @param {number} [frequency=250] - Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
|
||||
* @param {number} [quantity=0] - How many particles to launch. 0 = "all of the particles".
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, frequency, quantity) {
|
||||
|
||||
if (typeof explode !== 'boolean')
|
||||
{
|
||||
explode = true;
|
||||
}
|
||||
|
||||
lifespan = lifespan || 0;
|
||||
|
||||
// How many ms between emissions?
|
||||
frequency = frequency || 250;
|
||||
|
||||
// Total number of particles to emit
|
||||
quantity = quantity || 0;
|
||||
if (typeof explode === 'undefined') { explode = true; }
|
||||
if (typeof lifespan === 'undefined') { lifespan = 0; }
|
||||
if (typeof frequency === 'undefined') { frequency = 250; }
|
||||
if (typeof quantity === 'undefined') { quantity = 0; }
|
||||
|
||||
this.revive();
|
||||
|
||||
@@ -840,9 +791,9 @@ Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, f
|
||||
}
|
||||
|
||||
/**
|
||||
* This function can be used both internally and externally to emit the next particle.
|
||||
* @method Phaser.Particles.Arcade.Emitter#emitParticle
|
||||
*/
|
||||
* This function can be used both internally and externally to emit the next particle.
|
||||
* @method Phaser.Particles.Arcade.Emitter#emitParticle
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
|
||||
|
||||
var particle = this.getFirstExists(false);
|
||||
@@ -900,8 +851,7 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
|
||||
particle.scale.setTo(scale, scale);
|
||||
}
|
||||
|
||||
particle.body.drag.x = this.particleDrag.x;
|
||||
particle.body.drag.y = this.particleDrag.y;
|
||||
particle.body.friction = this.particleFriction;
|
||||
particle.body.angularDrag = this.angularDrag;
|
||||
|
||||
}
|
||||
@@ -909,8 +859,8 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
|
||||
/**
|
||||
* A more compact way of setting the width and height of the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#setSize
|
||||
* @param {number} width - The desired width of the emitter (particles are spawned randomly within these dimensions).
|
||||
* @param {number} height - The desired height of the emitter.
|
||||
* @param {number} width - The desired width of the emitter (particles are spawned randomly within these dimensions).
|
||||
* @param {number} height - The desired height of the emitter.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
|
||||
|
||||
@@ -922,8 +872,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
|
||||
/**
|
||||
* A more compact way of setting the X velocity range of the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#setXSpeed
|
||||
* @param {number} min - The minimum value for this range.
|
||||
* @param {number} max - The maximum value for this range.
|
||||
* @param {number} [min=0] - The minimum value for this range.
|
||||
* @param {number} [max=0] - The maximum value for this range.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
|
||||
|
||||
@@ -938,8 +888,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
|
||||
/**
|
||||
* A more compact way of setting the Y velocity range of the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#setYSpeed
|
||||
* @param {number} min - The minimum value for this range.
|
||||
* @param {number} max - The maximum value for this range.
|
||||
* @param {number} [min=0] - The minimum value for this range.
|
||||
* @param {number} [max=0] - The maximum value for this range.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
|
||||
|
||||
@@ -954,8 +904,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
|
||||
/**
|
||||
* A more compact way of setting the angular velocity constraints of the emitter.
|
||||
* @method Phaser.Particles.Arcade.Emitter#setRotation
|
||||
* @param {number} min - The minimum value for this range.
|
||||
* @param {number} max - The maximum value for this range.
|
||||
* @param {number} [min=0] - The minimum value for this range.
|
||||
* @param {number} [max=0] - The maximum value for this range.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
|
||||
|
||||
@@ -968,14 +918,17 @@ Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the emitter's midpoint to match the midpoint of a <code>Object</code>.
|
||||
* Change the emitters center to match the center of any object with a `center` property, such as a Sprite.
|
||||
* @method Phaser.Particles.Arcade.Emitter#at
|
||||
* @param {object} object - The <code>Object</code> that you want to sync up with.
|
||||
* @param {object|Phaser.Sprite} object - The object that you wish to match the center with.
|
||||
*/
|
||||
Phaser.Particles.Arcade.Emitter.prototype.at = function (object) {
|
||||
|
||||
this.emitX = object.center.x;
|
||||
this.emitY = object.center.y;
|
||||
if (object.center)
|
||||
{
|
||||
this.emitX = object.center.x;
|
||||
this.emitY = object.center.y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1111,13 +1064,13 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
|
||||
|
||||
|
||||
<span class="copyright">
|
||||
Phaser Copyright © 2012-2013 Photon Storm Ltd.
|
||||
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user