mirror of
https://github.com/wassname/phaser.git
synced 2026-08-08 11:23:41 +08:00
Working through building the docs.
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
* @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
|
||||
* @namespace Phaser
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,6 +119,7 @@ Phaser.Animation.prototype = {
|
||||
* Plays this animation.
|
||||
*
|
||||
* @method 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.
|
||||
* @return {Phaser.Animation} - A reference to this Animation instance.
|
||||
@@ -161,6 +162,7 @@ Phaser.Animation.prototype = {
|
||||
* Sets this animation back to the first frame and restarts the animation.
|
||||
*
|
||||
* @method restart
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
restart: function () {
|
||||
|
||||
@@ -180,6 +182,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
|
||||
* @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.
|
||||
*/
|
||||
stop: function (resetFrame) {
|
||||
@@ -200,6 +203,7 @@ Phaser.Animation.prototype = {
|
||||
* Updates this animation. Called automatically by the AnimationManager.
|
||||
*
|
||||
* @method update
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
update: function () {
|
||||
|
||||
@@ -266,6 +270,7 @@ Phaser.Animation.prototype = {
|
||||
* Cleans up this animation ready for deletion. Nulls all values and references.
|
||||
*
|
||||
* @method destroy
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
@@ -282,6 +287,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
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
onComplete: function () {
|
||||
|
||||
@@ -299,11 +305,13 @@ 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}
|
||||
*
|
||||
*/
|
||||
@@ -338,8 +346,8 @@ Object.defineProperty(Phaser.Animation.prototype, "paused", {
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the total number of frames in this Animation.
|
||||
* @memberof Phaser.Animation
|
||||
* @return {number}
|
||||
*
|
||||
*/
|
||||
@@ -353,11 +361,13 @@ 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}
|
||||
*
|
||||
*/
|
||||
@@ -395,12 +405,13 @@ 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
|
||||
* @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.
|
||||
* @param {string} [suffix=''] - The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.
|
||||
* @param {number} [zeroPad=0] - The number of zeroes to pad the min and max values with. If your frames are named 'explosion_0001' to 'explosion_0034' then the zeroPad is 4.
|
||||
* @method generateFrameNames
|
||||
*/
|
||||
Phaser.Animation.generateFrameNames = function (prefix, min, max, suffix, zeroPad) {
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
* @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.AnimationManager
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AnimationManager is used to add, play and update Phaser Animations.
|
||||
* The Animation Manager is used to add, play and update Phaser Animations.
|
||||
* Any Game Object such as Phaser.Sprite that supports animation contains a single AnimationManager instance.
|
||||
*
|
||||
* @class Phaser.AnimationManager
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @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.Frame
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @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.FrameData
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @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.Parser
|
||||
* @memberof Phaser.Animation
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,7 +77,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
||||
this.events = new Phaser.Events(this);
|
||||
|
||||
/**
|
||||
* @property {AnimationManager} animations - This manages animations of the sprite. You can modify animations through it. (see AnimationManager)
|
||||
* @property {Phaser.AnimationManager} animations - This manages animations of the sprite. You can modify animations through it. (see Phaser.AnimationManager)
|
||||
*/
|
||||
this.animations = new Phaser.AnimationManager(this);
|
||||
|
||||
|
||||
@@ -27,6 +27,12 @@ Phaser.Keyboard = function (game) {
|
||||
*/
|
||||
this._keys = {};
|
||||
|
||||
/**
|
||||
* @property {Description} _hotkeys - Description.
|
||||
* @private
|
||||
*/
|
||||
this._hotkeys = {};
|
||||
|
||||
/**
|
||||
* @property {Description} _capture - Description.
|
||||
* @private
|
||||
@@ -72,6 +78,31 @@ Phaser.Keyboard.prototype = {
|
||||
*/
|
||||
_onKeyUp: null,
|
||||
|
||||
addCallbacks: function (context, onDown, onUp) {
|
||||
|
||||
this.callbackContext = context;
|
||||
this.onDownCallback = onDown;
|
||||
|
||||
if (typeof onUp !== 'undefined')
|
||||
{
|
||||
this.onUpCallback = onUp;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
addKey: function (keycode) {
|
||||
|
||||
this._hotkeys[keycode] = new Phaser.Key(this.game, keycode);
|
||||
return this._hotkeys[keycode];
|
||||
|
||||
},
|
||||
|
||||
removeKey: function (keycode) {
|
||||
|
||||
delete (this._hotkeys[keycode]);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* @method start
|
||||
|
||||
Reference in New Issue
Block a user