Preparing more documentation.

This commit is contained in:
Richard Davey
2013-10-02 01:16:40 +01:00
parent 7c7cd8b01d
commit e5b1faace6
163 changed files with 214643 additions and 24491 deletions
-1
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @namespace Phaser
*/
/**
+16 -36
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Animation
*/
/**
@@ -118,7 +117,7 @@ Phaser.Animation.prototype = {
/**
* Plays this animation.
*
* @method play
* @method Phaser.Animation#play
* @memberof Phaser.Animation
* @param {number} [frameRate=null] - The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.
* @param {boolean} [loop=null] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
@@ -161,7 +160,7 @@ Phaser.Animation.prototype = {
/**
* Sets this animation back to the first frame and restarts the animation.
*
* @method restart
* @method Phaser.Animation#restart
* @memberof Phaser.Animation
*/
restart: function () {
@@ -181,7 +180,7 @@ Phaser.Animation.prototype = {
/**
* Stops playback of this animation and set it to a finished state. If a resetFrame is provided it will stop playback and set frame to the first in the animation.
*
* @method stop
* @method Phaser.Animation#stop
* @memberof Phaser.Animation
* @param {boolean} [resetFrame=false] - If true after the animation stops the currentFrame value will be set to the first frame in this animation.
*/
@@ -202,7 +201,7 @@ Phaser.Animation.prototype = {
/**
* Updates this animation. Called automatically by the AnimationManager.
*
* @method update
* @method Phaser.Animation#update
* @memberof Phaser.Animation
*/
update: function () {
@@ -269,7 +268,7 @@ Phaser.Animation.prototype = {
/**
* Cleans up this animation ready for deletion. Nulls all values and references.
*
* @method destroy
* @method Phaser.Animation#destroy
* @memberof Phaser.Animation
*/
destroy: function () {
@@ -286,7 +285,7 @@ Phaser.Animation.prototype = {
/**
* Called internally when the animation finishes playback. Sets the isPlaying and isFinished states and dispatches the onAnimationComplete event if it exists on the parent.
*
* @method onComplete
* @method Phaser.Animation#onComplete
* @memberof Phaser.Animation
*/
onComplete: function () {
@@ -304,17 +303,9 @@ Phaser.Animation.prototype = {
};
/**
* Sets the paused state of the Animation.
* @memberof Phaser.Animation
* @param {boolean} value - Set to true to pause the animation or false to resume it if previous paused.
*
*//**
*
* Returns the paused state of the Animation.
* @memberof Phaser.Animation
* @returns {boolean}
*
*/
* @name Phaser.Animation#paused
* @property {boolean} paused - Gets and sets the paused state of this Animation.
*/
Object.defineProperty(Phaser.Animation.prototype, "paused", {
get: function () {
@@ -346,11 +337,9 @@ Object.defineProperty(Phaser.Animation.prototype, "paused", {
});
/**
* Returns the total number of frames in this Animation.
* @memberof Phaser.Animation
* @return {number}
*
*/
* @name Phaser.Animation#frameTotal
* @property {number} frameTotal - The total number of frames in the currently loaded FrameData, or -1 if no FrameData is loaded.
*/
Object.defineProperty(Phaser.Animation.prototype, "frameTotal", {
get: function () {
@@ -360,17 +349,9 @@ Object.defineProperty(Phaser.Animation.prototype, "frameTotal", {
});
/**
* Sets the current frame to the given frame index and updates the texture cache.
* @memberof Phaser.Animation
* @param {number} value - The frame to display
*
*//**
*
* Returns the current frame, or if not set the index of the most recent frame.
* @memberof Phaser.Animation
* @returns {Animation.Frame}
*
*/
* @name Phaser.Animation#frame
* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
*/
Object.defineProperty(Phaser.Animation.prototype, "frame", {
get: function () {
@@ -405,8 +386,7 @@ Object.defineProperty(Phaser.Animation.prototype, "frame", {
* For example imagine you've got 30 frames named: 'explosion_0001-large' to 'explosion_0030-large'
* You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
*
* @method generateFrameNames
* @memberof Phaser.Animation
* @method Phaser.Animation.generateFrameNames
* @param {string} prefix - The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.
* @param {number} min - The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the min is 1.
* @param {number} max - The number to count up to. If your frames are named 'explosion_0001' to 'explosion_0034' the max is 34.
+18 -35
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @memberof Phaser.Animation
*/
/**
@@ -64,8 +63,7 @@ Phaser.AnimationManager.prototype = {
* Loads FrameData into the internal temporary vars and resets the frame index to zero.
* This is called automatically when a new Sprite is created.
*
* @method loadFrameData
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#loadFrameData
* @private
* @param {Phaser.Animation.FrameData} frameData - The FrameData set to load.
*/
@@ -80,12 +78,11 @@ Phaser.AnimationManager.prototype = {
* Adds a new animation under the given key. Optionally set the frames, frame rate and loop.
* Animations added in this way are played back with the play function.
*
* @method add
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#add
* @param {string} name - The unique (within this Sprite) name for the animation, i.e. "run", "fire", "walk".
* @param {Array} [frames=null] - An array of numbers/strings that correspond to the frames to add to this animation and in which order. e.g. [1, 2, 3] or ['run0', 'run1', run2]). If null then all frames will be used.
* @param {number} [frameRate=60] - The speed at which the animation should play. The speed is given in frames per second.
* @param {boolean} [loop=false] {boolean} - Whether or not the animation is looped or just plays once.
* @param {boolean} [loop=false] - Whether or not the animation is looped or just plays once.
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings?
* @return {Phaser.Animation} The Animation object that was created.
*/
@@ -126,8 +123,7 @@ Phaser.AnimationManager.prototype = {
/**
* Check whether the frames in the given array are valid and exist.
*
* @method validateFrames
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#validateFrames
* @param {Array} frames - An array of frames to be validated.
* @param {boolean} [useNumericIndex=true] - Validate the frames based on their numeric index (true) or string index (false)
* @return {boolean} True if all given Frames are valid, otherwise false.
@@ -162,8 +158,7 @@ Phaser.AnimationManager.prototype = {
* Play an animation based on the given key. The animation should previously have been added via sprite.animations.add()
* If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.
*
* @method play
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#play
* @param {string} name - The name of the animation to be played, e.g. "fire", "walk", "jump".
* @param {number} [frameRate=null] - The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.
* @param {boolean} [loop=null] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
@@ -193,8 +188,7 @@ Phaser.AnimationManager.prototype = {
* Stop playback of an animation. If a name is given that specific animation is stopped, otherwise the current animation is stopped.
* The currentAnim property of the AnimationManager is automatically set to the animation given.
*
* @method stop
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#stop
* @param {string} [name=null] - The name of the animation to be stopped, e.g. "fire". If none is given the currently running animation is stopped.
* @param {boolean} [resetFrame=false] - When the animation is stopped should the currentFrame be set to the first frame of the animation (true) or paused on the last frame displayed (false)
*/
@@ -223,8 +217,7 @@ Phaser.AnimationManager.prototype = {
/**
* The main update function is called by the Sprites update loop. It's responsible for updating animation frames and firing related events.
*
* @method update
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#update
* @protected
* @return {boolean} True if a new animation frame has been set, otherwise false.
*/
@@ -249,8 +242,7 @@ Phaser.AnimationManager.prototype = {
/**
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
*
* @method destroy
* @memberof Phaser.AnimationManager
* @method Phaser.AnimationManager#destroy
*/
destroy: function () {
@@ -265,8 +257,8 @@ Phaser.AnimationManager.prototype = {
};
/**
* @memberof Phaser.AnimationManager
* @return {Phaser.Animation.FrameData} Returns the FrameData of the current animation.
* @name Phaser.AnimationManager#frameData
* @property {Phaser.Animation.FrameData} frameData - The current animations FrameData.
*/
Object.defineProperty(Phaser.AnimationManager.prototype, "frameData", {
@@ -277,8 +269,8 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameData", {
});
/**
* @memberof Phaser.AnimationManager
* @return {number} Returns the total number of frames in the loaded FrameData, or -1 if no FrameData is loaded.
* @name Phaser.AnimationManager#frameTotal
* @property {number} frameTotal - The total number of frames in the currently loaded FrameData, or -1 if no FrameData is loaded.
*/
Object.defineProperty(Phaser.AnimationManager.prototype, "frameTotal", {
@@ -297,11 +289,8 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameTotal", {
});
/**
* @memberof Phaser.AnimationManager
* @return {boolean} Returns the paused state of the current animation.
*//**
* @memberof Phaser.AnimationManager
* @param {boolean} value - Sets the paused state of the current animation.
* @name Phaser.AnimationManager#paused
* @property {boolean} paused - Gets and sets the paused state of the current animation.
*/
Object.defineProperty(Phaser.AnimationManager.prototype, "paused", {
@@ -320,11 +309,8 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "paused", {
});
/**
* @memberof Phaser.AnimationManager
* @return {number} Returns the index of the current frame.
*//**
* @memberof Phaser.AnimationManager
* @param {number} value - Sets the current frame on the Sprite and updates the texture cache for display.
* @name Phaser.AnimationManager#frame
* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
*/
Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
@@ -352,11 +338,8 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
});
/**
* @memberof Phaser.AnimationManager
* @return {string} Returns the name of the current frame if it has one.
*//**
* @memberof Phaser.AnimationManager
* @param {string} value - Sets the current frame on the Sprite and updates the texture cache for display.
* @name Phaser.AnimationManager#frameName
* @property {string} frameName - Gets or sets the current frame name and updates the Texture Cache for display.
*/
Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", {
+1 -3
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @memberof Phaser.Animation
*/
/**
@@ -129,8 +128,7 @@ Phaser.Animation.Frame.prototype = {
/**
* If the frame was trimmed when added to the Texture Atlas this records the trim and source data.
*
* @method setTrim
* @memberof Phaser.Animation.Frame
* @method Phaser.Animation.Frame#setTrim
* @param {boolean} trimmed - If this frame was trimmed or not.
* @param {number} actualWidth - The width of the frame before being trimmed.
* @param {number} actualHeight - The height of the frame before being trimmed.
+11 -23
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @memberof Phaser.Animation
*/
/**
@@ -33,8 +32,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.
*
* @method addFrame
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#addFrame
* @param {Phaser.Animation.Frame} frame - The frame to add to this FrameData set.
* @return {Phaser.Animation.Frame} The frame that was just added.
*/
@@ -56,8 +54,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Get a Frame by its numerical index.
*
* @method getFrame
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#getFrame
* @param {number} index - The index of the frame you want to get.
* @return {Phaser.Animation.Frame} The frame, if found.
*/
@@ -75,8 +72,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Get a Frame by its frame name.
*
* @method getFrameByName
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#getFrameByName
* @param {string} name - The name of the frame you want to get.
* @return {Phaser.Animation.Frame} The frame, if found.
*/
@@ -94,8 +90,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Check if there is a Frame with the given name.
*
* @method checkFrameName
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#checkFrameName
* @param {string} name - The name of the frame you want to check.
* @return {boolean} True if the frame is found, otherwise false.
*/
@@ -113,8 +108,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Returns a range of frames based on the given start and end frame indexes and returns them in an Array.
*
* @method getFrameRange
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#getFrameRange
* @param {number} start - The starting frame index.
* @param {number} end - The ending frame index.
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -137,8 +131,7 @@ Phaser.Animation.FrameData.prototype = {
* Returns all of the Frames in this FrameData set where the frame index is found in the input array.
* The frames are returned in the output array, or if none is provided in a new Array object.
*
* @method getFrames
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#getFrames
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -185,8 +178,7 @@ Phaser.Animation.FrameData.prototype = {
* Returns all of the Frame indexes in this FrameData set.
* The frames indexes are returned in the output array, or if none is provided in a new Array object.
*
* @method getFrameIndexes
* @memberof Phaser.Animation.FrameData
* @method Phaser.Animation.FrameData#getFrameIndexes
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -228,18 +220,14 @@ Phaser.Animation.FrameData.prototype = {
};
/**
* @name Phaser.Animation.FrameData#total
* @property {number} total - The total number of frames in this FrameData set.
*/
Object.defineProperty(Phaser.Animation.FrameData.prototype, "total", {
/**
* Returns the total number of frames in this FrameData set.
*
* @method total
* @memberof Phaser.Animation.FrameData
* @return {number} The total number of frames in this FrameData set.
*/
get: function () {
return this._frames.length;
}
});
+4 -9
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @memberof Phaser.Animation
*/
/**
@@ -15,8 +14,7 @@ Phaser.Animation.Parser = {
/**
* Parse a Sprite Sheet and extract the animation frame data from it.
*
* @method spriteSheet
* @memberof Phaser.Animation.Parser
* @method Phaser.Animation.Parser.spriteSheet
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {string} key - The Game.Cache asset key of the Sprite Sheet image.
* @param {number} frameWidth - The fixed width of each frame of the animation.
@@ -97,8 +95,7 @@ Phaser.Animation.Parser = {
/**
* Parse the JSON data and extract the animation frame data from it.
*
* @method JSONData
* @memberof Phaser.Animation.Parser
* @method Phaser.Animation.Parser.JSONData
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Object} json - The JSON data from the Texture Atlas. Must be in Array format.
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
@@ -169,8 +166,7 @@ Phaser.Animation.Parser = {
/**
* Parse the JSON data and extract the animation frame data from it.
*
* @method JSONDataHash
* @memberof Phaser.Animation.Parser
* @method Phaser.Animation.Parser.JSONDataHash
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
@@ -244,8 +240,7 @@ Phaser.Animation.Parser = {
/**
* Parse the XML data and extract the animation frame data from it.
*
* @method XMLData
* @memberof Phaser.Animation.Parser
* @method Phaser.Animation.Parser.XMLData
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
+40 -36
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Camera
*/
/**
@@ -10,7 +9,7 @@
* A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view.
* The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y
*
* @class Camera
* @class Phaser.Camera
* @constructor
* @param {Phaser.Game} game - Game reference to the currently running game.
* @param {number} id - Not being used at the moment, will be when Phaser supports multiple camera
@@ -75,25 +74,43 @@ Phaser.Camera = function (game, id, x, y, width, height) {
this.target = null;
/**
* @property {number} edge - Edge property. Description.
* @property {number} edge - Edge property.
* @private
* @default
*/
this._edge = 0;
};
// Consts
/**
* @constant
* @type {number}
*/
Phaser.Camera.FOLLOW_LOCKON = 0;
/**
* @constant
* @type {number}
*/
Phaser.Camera.FOLLOW_PLATFORMER = 1;
/**
* @constant
* @type {number}
*/
Phaser.Camera.FOLLOW_TOPDOWN = 2;
/**
* @constant
* @type {number}
*/
Phaser.Camera.FOLLOW_TOPDOWN_TIGHT = 3;
Phaser.Camera.prototype = {
/**
* Tells this camera which sprite to follow.
* @method follow
* @memberof Phaser.Camera
* @method Phaser.Camera#follow
* @param {Phaser.Sprite} target - The object you want the camera to track. Set to null to not follow anything.
* @param {number} [style] Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
*/
@@ -133,8 +150,7 @@ Phaser.Camera.prototype = {
/**
* Move the camera focus to a location instantly.
* @method focusOnXY
* @memberof Phaser.Camera
* @method Phaser.Camera#focusOnXY
* @param {number} x - X position.
* @param {number} y - Y position.
*/
@@ -147,8 +163,7 @@ Phaser.Camera.prototype = {
/**
* Update focusing and scrolling.
* @method update
* @memberof Phaser.Camera
* @method Phaser.Camera#update
*/
update: function () {
@@ -198,8 +213,7 @@ Phaser.Camera.prototype = {
/**
* Method called to ensure the camera doesn't venture outside of the game world.
* @method checkWorldBounds
* @memberof Phaser.Camera
* @method Phaser.Camera#checkWorldBounds
*/
checkWorldBounds: function () {
@@ -239,8 +253,7 @@ Phaser.Camera.prototype = {
* A helper function to set both the X and Y properties of the camera at once
* without having to use game.camera.x and game.camera.y.
*
* @method setPosition
* @memberof Phaser.Camera
* @method Phaser.Camera#setPosition
* @param {number} x - X position.
* @param {number} y - Y position.
*/
@@ -255,8 +268,7 @@ Phaser.Camera.prototype = {
/**
* Sets the size of the view rectangle given the width and height in parameters.
*
* @method setSize
* @memberof Phaser.Camera
* @method Phaser.Camera#setSize
* @param {number} width - The desired width.
* @param {number} height - The desired height.
*/
@@ -270,11 +282,9 @@ Phaser.Camera.prototype = {
};
/**
* Get
* @return {number} The x position.
*//**
* Sets the camera's x position and clamp it if it's outside the world bounds.
* @param {number} value - The x position.
* The Cameras x coordinate. This value is automatically clamped if it falls outside of the World bounds.
* @name Phaser.Camera#x
* @property {number} x - Gets or sets the cameras x position.
*/
Object.defineProperty(Phaser.Camera.prototype, "x", {
@@ -290,11 +300,9 @@ Object.defineProperty(Phaser.Camera.prototype, "x", {
});
/**
* Get
* @return {number} The y position.
*//**
* Sets the camera's y position and clamp it if it's outside the world bounds.
* @param {number} value - The y position.
* The Cameras y coordinate. This value is automatically clamped if it falls outside of the World bounds.
* @name Phaser.Camera#y
* @property {number} y - Gets or sets the cameras y position.
*/
Object.defineProperty(Phaser.Camera.prototype, "y", {
@@ -310,11 +318,9 @@ Object.defineProperty(Phaser.Camera.prototype, "y", {
});
/**
* Returns the width of the view rectangle, in pixels.
* @return {number} The width of the view rectangle, in pixels.
*//**
* Sets the width of the view rectangle.
* @param {number} value - Width of the view rectangle.
* The Cameras width. By default this is the same as the Game size and should not be adjusted for now.
* @name Phaser.Camera#width
* @property {number} width - Gets or sets the cameras width.
*/
Object.defineProperty(Phaser.Camera.prototype, "width", {
@@ -329,11 +335,9 @@ Object.defineProperty(Phaser.Camera.prototype, "width", {
});
/**
* Returns the height of the view rectangle, in pixels.
* @return {number} The height of the view rectangle, in pixels.
*//**
* Sets the height of the view rectangle.
* @param {number} value - Height of the view rectangle.
* The Cameras height. By default this is the same as the Game size and should not be adjusted for now.
* @name Phaser.Camera#height
* @property {number} height - Gets or sets the cameras height.
*/
Object.defineProperty(Phaser.Camera.prototype, "height", {
+14 -17
View File
@@ -2,14 +2,13 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Game
*/
/**
* Game constructor
*
* Instantiate a new <code>Phaser.Game</code> object.
* @class
* @class Phaser.Game
* @classdesc This is where the magic happens. The Game object is the heart of your game,
* providing quick access to common functions and handling the boot process.
* <p>"Hell, there are no rules here - we're trying to accomplish something."</p><br>
@@ -252,8 +251,8 @@ Phaser.Game.prototype = {
/**
* Initialize engine sub modules and start the game.
*
* @method boot
* @memberof Phaser.Game
* @method Phaser.Game#boot
* @protected
*/
boot: function () {
@@ -333,8 +332,8 @@ Phaser.Game.prototype = {
/**
* Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
*
* @method setUpRenderer
* @memberof Phaser.Game
* @method Phaser.Game#setUpRenderer
* @protected
*/
setUpRenderer: function () {
@@ -370,8 +369,8 @@ Phaser.Game.prototype = {
/**
* Called when the load has finished, after preload was run.
*
* @method loadComplete
* @memberof Phaser.Game
* @method Phaser.Game#loadComplete
* @protected
*/
loadComplete: function () {
@@ -384,8 +383,8 @@ Phaser.Game.prototype = {
/**
* The core game loop.
*
* @method update
* @memberof Phaser.Game
* @method Phaser.Game#update
* @protected
* @param {number} time - The current time as provided by RequestAnimationFrame.
*/
update: function (time) {
@@ -419,8 +418,7 @@ Phaser.Game.prototype = {
/**
* Nuke the entire game from orbit
*
* @method destroy
* @memberof Phaser.Game
* @method Phaser.Game#destroy
*/
destroy: function () {
@@ -441,11 +439,10 @@ Phaser.Game.prototype = {
};
/**
* Get
* @returns {boolean} - The paused state of the game.
*//**
* Set
* @param {boolean} value - Put the game into a paused state or resume it. A paused game doesn't call any of the subsystems.
* The paused state of the Game. A paused game doesn't update any of its subsystems.
* When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched.
* @name Phaser.Game#paused
* @property {boolean} paused - Gets and sets the paused state of the Game.
*/
Object.defineProperty(Phaser.Game.prototype, "paused", {
+50 -87
View File
@@ -2,7 +2,6 @@
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Group
*/
/**
@@ -85,8 +84,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method add
* @memberof Phaser.Group
* @method Phaser.Group#add
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -111,8 +109,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method addAt
* @memberof Phaser.Group
* @method Phaser.Group#addAt
* @param {Description} child - Description.
* @param {Description} index - Description.
* @return {Description} Description.
@@ -138,7 +135,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method getAt
* @method Phaser.Group#getAt
* @memberof Phaser.Group
* @param {Description} index - Description.
* @return {Description} Description.
@@ -152,8 +149,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method create
* @memberof Phaser.Group
* @method Phaser.Group#create
* @param {number} x - Description.
* @param {number} y - Description.
* @param {string} key - Description.
@@ -184,8 +180,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method swap
* @memberof Phaser.Group
* @method Phaser.Group#swap
* @param {Description} child1 - Description.
* @param {Description} child2 - Description.
* @return {boolean} Description.
@@ -313,8 +308,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method bringToTop
* @memberof Phaser.Group
* @method Phaser.Group#bringToTop
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -333,8 +327,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method getIndex
* @memberof Phaser.Group
* @method Phaser.Group#getIndex
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -347,8 +340,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method replace
* @memberof Phaser.Group
* @method Phaser.Group#replace
* @param {Description} oldChild - Description.
* @param {Description} newChild - Description.
*/
@@ -379,8 +371,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method setProperty
* @memberof Phaser.Group
* @method Phaser.Group#setProperty
* @param {Description} child - Description.
* @param {array} key - An array of values that will be set.
* @param {Description} value - Description.
@@ -443,8 +434,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method setAll
* @memberof Phaser.Group
* @method Phaser.Group#setAll
* @param {Description} key - Description.
* @param {Description} value - Description.
* @param {Description} checkAlive - Description.
@@ -482,8 +472,7 @@ Phaser.Group.prototype = {
* Adds the amount to the given property on all children in this Group.
* Group.addAll('x', 10) will add 10 to the child.x value.
*
* @method addAll
* @memberof Phaser.Group
* @method Phaser.Group#addAll
* @param {string} property - The property to increment, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -499,8 +488,7 @@ Phaser.Group.prototype = {
* Subtracts the amount from the given property on all children in this Group.
* Group.subAll('x', 10) will minus 10 from the child.x value.
*
* @method subAll
* @memberof Phaser.Group
* @method Phaser.Group#subAll
* @param {string} property - The property to decrement, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -516,8 +504,7 @@ Phaser.Group.prototype = {
* Multiplies the given property by the amount on all children in this Group.
* Group.multiplyAll('x', 2) will x2 the child.x value.
*
* @method multiplyAll
* @memberof Phaser.Group
* @method Phaser.Group#multiplyAll
* @param {string} property - The property to multiply, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -533,8 +520,7 @@ Phaser.Group.prototype = {
* Divides the given property by the amount on all children in this Group.
* Group.divideAll('x', 2) will half the child.x value.
*
* @method divideAll
* @memberof Phaser.Group
* @method Phaser.Group#divideAll
* @param {string} property - The property to divide, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -550,8 +536,7 @@ Phaser.Group.prototype = {
* Calls a function on all of the children that have exists=true in this Group.
* After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback.
*
* @method callAllExists
* @memberof Phaser.Group
* @method Phaser.Group#callAllExists
* @param {function} callback - The function that exists on the children that will be called.
* @param {boolean} existsValue - Only children with exists=existsValue will be called.
* @param {...*} parameter - Additional parameters that will be passed to the callback.
@@ -583,8 +568,7 @@ Phaser.Group.prototype = {
* Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that)
* After the callback parameter you can add as many extra parameters as you like, which will all be passed to the child.
*
* @method callAll
* @memberof Phaser.Group
* @method Phaser.Group#callAll
* @param {function} callback - The function that exists on the children that will be called.
* @param {...*} parameter - Additional parameters that will be passed to the callback.
*/
@@ -615,8 +599,7 @@ Phaser.Group.prototype = {
* Description.
* After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
*
* @method forEach
* @memberof Phaser.Group
* @method Phaser.Group#forEach
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
* @param {boolean} checkExists - Description.
@@ -654,8 +637,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method forEachAlive
* @memberof Phaser.Group
* @method Phaser.Group#forEachAlive
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
*/
@@ -687,8 +669,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method forEachDead
* @memberof Phaser.Group
* @method Phaser.Group#forEachDead
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
*/
@@ -719,8 +700,7 @@ Phaser.Group.prototype = {
/**
* Call this function to retrieve the first object with exists == (the given state) in the group.
*
* @method getFirstExists
* @memberof Phaser.Group
* @method Phaser.Group#getFirstExists
* @param {Description} state - Description.
* @return {Any} The first child, or null if none found.
*/
@@ -755,8 +735,7 @@ Phaser.Group.prototype = {
* Call this function to retrieve the first object with alive == true in the group.
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @method getFirstAlive
* @memberof Phaser.Group
* @method Phaser.Group#getFirstAlive
* @return {Any} The first alive child, or null if none found.
*/
getFirstAlive: function () {
@@ -785,8 +764,7 @@ Phaser.Group.prototype = {
* Call this function to retrieve the first object with alive == false in the group.
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @method getFirstDead
* @memberof Phaser.Group
* @method Phaser.Group#getFirstDead
* @return {Any} The first dead child, or null if none found.
*/
getFirstDead: function () {
@@ -814,8 +792,7 @@ Phaser.Group.prototype = {
/**
* Call this function to find out how many members of the group are alive.
*
* @method countLiving
* @memberof Phaser.Group
* @method Phaser.Group#countLiving
* @return {number} The number of children flagged as alive. Returns -1 if Group is empty.
*/
countLiving: function () {
@@ -845,8 +822,7 @@ Phaser.Group.prototype = {
/**
* Call this function to find out how many members of the group are dead.
*
* @method countDead
* @memberof Phaser.Group
* @method Phaser.Group#countDead
* @return {number} The number of children flagged as dead. Returns -1 if Group is empty.
*/
countDead: function () {
@@ -876,8 +852,7 @@ Phaser.Group.prototype = {
/**
* Returns a member at random from the group.
*
* @method getRandom
* @memberof Phaser.Group
* @method Phaser.Group#getRandom
* @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array.
* @param {number} length - Optional restriction on the number of values you want to randomly select from.
* @return {Any} A random child of this Group.
@@ -899,8 +874,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method remove
* @memberof Phaser.Group
* @method Phaser.Group#remove
* @param {Description} child - Description.
*/
remove: function (child) {
@@ -914,8 +888,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method removeAll
* @memberof Phaser.Group
* @method Phaser.Group#removeAll
*/
removeAll: function () {
@@ -939,8 +912,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method removeBetween
* @memberof Phaser.Group
* @method Phaser.Group#removeBetween
* @param {Description} startIndex - Description.
* @param {Description} endIndex - Description.
*/
@@ -968,8 +940,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method destroy
* @memberof Phaser.Group
* @method Phaser.Group#destroy
*/
destroy: function () {
@@ -988,8 +959,7 @@ Phaser.Group.prototype = {
/**
* Description.
*
* @method dump
* @memberof Phaser.Group
* @method Phaser.Group#dump
*/
dump: function (full) {
@@ -1079,8 +1049,8 @@ Phaser.Group.prototype = {
/**
* Get
* @return {Description}
* @name Phaser.Group#length
* @property {number} length - The number of children in this Group.
*/
Object.defineProperty(Phaser.Group.prototype, "length", {
@@ -1091,11 +1061,10 @@ Object.defineProperty(Phaser.Group.prototype, "length", {
});
/**
* Get
* @return {Description}
*//**
* Set
* @param {Description} value - Description
* The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.
* @name Phaser.Group#x
* @property {number} x - The x coordinate of the Group container.
*/
Object.defineProperty(Phaser.Group.prototype, "x", {
@@ -1110,11 +1079,10 @@ Object.defineProperty(Phaser.Group.prototype, "x", {
});
/**
* Get
* @return {Description}
*//**
* Set
* @param {Description} value - Description
* The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.
* @name Phaser.Group#y
* @property {number} y - The y coordinate of the Group container.
*/
Object.defineProperty(Phaser.Group.prototype, "y", {
@@ -1129,11 +1097,10 @@ Object.defineProperty(Phaser.Group.prototype, "y", {
});
/**
* Get
* @return {Description}
*//**
* Set
* @param {Description} value - Description
* The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
* This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.
* @name Phaser.Group#angle
* @property {number} angle - The angle of rotation given in degrees, where 0 degrees = to the right.
*/
Object.defineProperty(Phaser.Group.prototype, "angle", {
@@ -1148,11 +1115,10 @@ Object.defineProperty(Phaser.Group.prototype, "angle", {
});
/**
* Get
* @return {Description}
*//**
* Set
* @param {Description} value - Description
* The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
* This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.
* @name Phaser.Group#rotation
* @property {number} rotation - The angle of rotation given in radians.
*/
Object.defineProperty(Phaser.Group.prototype, "rotation", {
@@ -1167,11 +1133,8 @@ Object.defineProperty(Phaser.Group.prototype, "rotation", {
});
/**
* Get
* @return {Description}
*//**
* Set
* @param {Description} value - Description.
* @name Phaser.Group#visible
* @property {boolean} visible - The visible state of the Group. Non-visible Groups and all of their children are not rendered.
*/
Object.defineProperty(Phaser.Group.prototype, "visible", {
+4
View File
@@ -51,6 +51,7 @@ Phaser.LinkedList.prototype = {
* Add element to a linked list.
*
* @method add
* @memberof Phaser.LinkedList
* @param {object} child - Description.
* @return {object} Description.
*/
@@ -84,6 +85,7 @@ Phaser.LinkedList.prototype = {
* Remove element from a linked list.
*
* @method remove
* @memberof Phaser.LinkedList
* @param {object} child - Description.
*/
remove: function (child) {
@@ -103,6 +105,7 @@ Phaser.LinkedList.prototype = {
* Description.
*
* @method callAll
* @memberof Phaser.LinkedList
* @param {object} callback - Description.
*/
callAll: function (callback) {
@@ -132,6 +135,7 @@ Phaser.LinkedList.prototype = {
* Description.
*
* @method dump
* @memberof Phaser.LinkedList
*/
dump: function () {
+10 -1
View File
@@ -14,7 +14,6 @@
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Description} parent - Description.
*
*/
Phaser.Plugin = function (game, parent) {
@@ -71,6 +70,8 @@ Phaser.Plugin.prototype = {
/**
* Pre-update is called at the start of the update cycle, before any other updates have taken place (including Physics).
* It is only called if active is set to true.
* @method preUpdate
* @memberof Phaser.Plugin
*/
preUpdate: function () {
},
@@ -78,6 +79,8 @@ Phaser.Plugin.prototype = {
/**
* Update is called after all the core subsystems (Input, Tweens, Sound, etc) and the State have updated, but before the render.
* It is only called if active is set to true.
* @method update
* @memberof Phaser.Plugin
*/
update: function () {
},
@@ -85,6 +88,8 @@ Phaser.Plugin.prototype = {
/**
* Render is called right after the Game Renderer completes, but before the State.render.
* It is only called if visible is set to true.
* @method render
* @memberof Phaser.Plugin
*/
render: function () {
},
@@ -92,12 +97,16 @@ Phaser.Plugin.prototype = {
/**
* Post-render is called after the Game Renderer and State.render have run.
* It is only called if visible is set to true.
* @method postRender
* @memberof Phaser.Plugin
*/
postRender: function () {
},
/**
* Clear down this Plugin and null out references
* @method destroy
* @memberof Phaser.Plugin
*/
destroy: function () {
+9 -2
View File
@@ -5,8 +5,6 @@
* @module Phaser.PluginManager
*/
// TODO: We can optimise this a lot by using separate hashes per function (update, render, etc)
/**
* Description.
*
@@ -48,6 +46,8 @@ Phaser.PluginManager.prototype = {
/**
* Add a new Plugin to the PluginManager.
* The plugin's game and parent reference are set to this game and pluginmanager parent.
* @method add
* @memberof Phaser.PluginManager
* @param {Phaser.Plugin} plugin - Description.
* @return {Phaser.Plugin} Description.
*/
@@ -115,6 +115,8 @@ Phaser.PluginManager.prototype = {
/**
* Remove a Plugin from the PluginManager.
* @method remove
* @memberof Phaser.PluginManager
* @param {Phaser.Plugin} plugin - Description.
*/
remove: function (plugin) {
@@ -128,6 +130,7 @@ Phaser.PluginManager.prototype = {
* Description.
*
* @method preUpdate
* @memberof Phaser.PluginManager
*/
preUpdate: function () {
@@ -150,6 +153,7 @@ Phaser.PluginManager.prototype = {
* Description.
*
* @method update
* @memberof Phaser.PluginManager
*/
update: function () {
@@ -172,6 +176,7 @@ Phaser.PluginManager.prototype = {
* Description.
*
* @method render
* @memberof Phaser.PluginManager
*/
render: function () {
@@ -194,6 +199,7 @@ Phaser.PluginManager.prototype = {
* Description.
*
* @method postRender
* @memberof Phaser.PluginManager
*/
postRender: function () {
@@ -216,6 +222,7 @@ Phaser.PluginManager.prototype = {
* Description.
*
* @method destroy
* @memberof Phaser.PluginManager
*/
destroy: function () {
+1 -5
View File
@@ -5,13 +5,9 @@
* @module Phaser.Signal
*/
/**
*
* A Signal is used for object communication via a custom broadcaster instead of Events.
*
* @class Phaser.Signal
* @classdesc Phaser Signal
* @classdesc A Signal is used for object communication via a custom broadcaster instead of Events.
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
* @constructor
*/
+16
View File
@@ -111,6 +111,22 @@ Phaser.State.prototype = {
preload: function () {
},
/**
* Put update logic here.
*
* @method loadUpdate
*/
loadUpdate: function () {
},
/**
* Put render operations here.
*
* @method loadRender
*/
loadRender: function () {
},
/**
* This method is called after the game engine successfully switches states.
* Feel free to add any setup code here (do not load anything here, override preload() instead).