Finish document for AnimationManager, Tile, FrameData, BootScreen, PauseScreen.

This commit is contained in:
Sean
2013-05-04 19:53:11 +08:00
committed by Richard Davey
parent 1052df6660
commit e88c48641d
5 changed files with 45 additions and 42 deletions
+15 -10
View File
@@ -18,10 +18,9 @@ module Phaser {
/**
* AnimationManager constructor
*
* Create a new <code>AnimationManager</code>.
*
* @param parent Owner sprite of this manager.
* @param parent {Sprite} Owner sprite of this manager.
*/
constructor(game: Game, parent: Sprite) {
@@ -78,11 +77,11 @@ module Phaser {
/**
* Add a new animation.
* @param name What this animation should be called (e.g. "run").
* @param frames An array of numbers/strings indicating what frames to play in what order (e.g. [1, 2, 3] or ['run0', 'run1', run2]).
* @param frameRate The speed in frames per second that the animation should play at (e.g. 60 fps).
* @param loop Whether or not the animation is looped or just plays once.
* @param useNumericIndex Use number indexes instead of string indexes?
* @param name {string} What this animation should be called (e.g. "run").
* @param frames {any[]} An array of numbers/strings indicating what frames to play in what order (e.g. [1, 2, 3] or ['run0', 'run1', run2]).
* @param frameRate {number} The speed in frames per second that the animation should play at (e.g. 60 fps).
* @param loop {boolean} Whether or not the animation is looped or just plays once.
* @param useNumericIndex {boolean} Use number indexes instead of string indexes?
*/
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true) {
@@ -116,6 +115,12 @@ module Phaser {
}
/**
* Check whether the frames is valid.
* @param frames {any[]} Frames to be validated.
* @param useNumericIndex {boolean} Does these frames use number indexes or string indexes?
* @return {boolean} True if they're valid, otherwise return false.
*/
private validateFrames(frames: any[], useNumericIndex: bool): bool {
for (var i = 0; i < frames.length; i++)
@@ -142,9 +147,9 @@ module Phaser {
/**
* Play animation with specific name.
* @param name The string name of the animation you want to play.
* @param frameRate FrameRate you want to specify instead of using default.
* @param loop Whether or not the animation is looped or just plays once.
* @param name {string} The string name of the animation you want to play.
* @param frameRate {number} FrameRate you want to specify instead of using default.
* @param loop {boolean} Whether or not the animation is looped or just plays once.
*/
public play(name: string, frameRate?: number = null, loop?: bool) {
+8 -8
View File
@@ -14,10 +14,10 @@ module Phaser {
* Tile constructor
* Create a new <code>Tile</code>.
*
* @param tilemap the tilemap this tile belongs to.
* @param index The index of this tile type in the core map data.
* @param width Width of the tile.
* @param height Height of the tile.
* @param tilemap {Tilemap} the tilemap this tile belongs to.
* @param index {number} The index of this tile type in the core map data.
* @param width {number} Width of the tile.
* @param height number} Height of the tile.
*/
constructor(game: Game, tilemap: Tilemap, index: number, width: number, height: number) {
@@ -121,10 +121,10 @@ module Phaser {
/**
* Set collision configs.
* @param collision Bit field of flags. (see Tile.allowCollision)
* @param resetCollisions Reset collision flags before set.
* @param separateX Enable seprate at x-axis.
* @param separateY Enable seprate at y-axis.
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
* @param resetCollisions {boolean} Reset collision flags before set.
* @param separateX {boolean} Enable seprate at x-axis.
* @param separateY {boolean} Enable seprate at y-axis.
*/
public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) {
+18 -18
View File
@@ -35,8 +35,8 @@ module Phaser {
/**
* Add a new frame.
* @param frame The frame you want to add.
* @return {Frame=} The frame you just added.
* @param frame {Frame} The frame you want to add.
* @return {Frame} The frame you just added.
*/
public addFrame(frame: Frame): Frame {
@@ -55,8 +55,8 @@ module Phaser {
/**
* Get a frame by its index.
* @param index Index of the frame you want to get.
* @return {Frame=} The frame you want.
* @param index {number} Index of the frame you want to get.
* @return {Frame} The frame you want.
*/
public getFrame(index: number): Frame {
@@ -71,8 +71,8 @@ module Phaser {
/**
* Get a frame by its name.
* @param name Name of the frame you want to get.
* @return {Frame=} The frame you want.
* @param name {string} Name of the frame you want to get.
* @return {Frame} The frame you want.
*/
public getFrameByName(name: string): Frame {
@@ -87,7 +87,7 @@ module Phaser {
/**
* Check whether there's a frame with given name.
* @param name Name of the frame you want to check.
* @param name {string} Name of the frame you want to check.
* @return {boolean} True if frame with given name found, otherwise return false.
*/
public checkFrameName(name: string): bool {
@@ -103,10 +103,10 @@ module Phaser {
/**
* Get ranges of frames in an array.
* @param start Start index of frames you want.
* @param end End index of frames you want.
* @param output Optional, result will be added into this array.
* @return {array} Ranges of specific frames in an array.
* @param start {number} Start index of frames you want.
* @param end {number} End index of frames you want.
* @param output {Frame[]} Optional, result will be added into this array.
* @return {Frame[]} Ranges of specific frames in an array.
*/
public getFrameRange(start: number, end: number, output?: Frame[] = []): Frame[] {
@@ -121,8 +121,8 @@ module Phaser {
/**
* Get all indexes of frames by giving their name.
* @param output Optional, result will be added into this array.
* @return {array} Indexes of specific frames in an array.
* @param output {number[]} Optional, result will be added into this array.
* @return {number[]} Indexes of specific frames in an array.
*/
public getFrameIndexes(output?: number[] = []): number[] {
@@ -139,8 +139,8 @@ module Phaser {
/**
* Get all names of frames by giving their indexes.
* @param output Optional, result will be added into this array.
* @return {array} Names of specific frames in an array.
* @param output {number[]} Optional, result will be added into this array.
* @return {number[]} Names of specific frames in an array.
*/
public getFrameIndexesByName(input: string[]): number[] {
@@ -160,7 +160,7 @@ module Phaser {
/**
* Get all frames in this frame data.
* @return {array} All the frames in an array.
* @return {Frame[]} All the frames in an array.
*/
public getAllFrames(): Frame[] {
return this._frames;
@@ -168,8 +168,8 @@ module Phaser {
/**
* Get All frames with specific ranges.
* @param range Ranges in an array.
* @return All frames in an array.
* @param range {number[]} Ranges in an array.
* @return {Frame[]} All frames in an array.
*/
public getFrames(range: number[]) {
+2 -3
View File
@@ -12,11 +12,10 @@ module Phaser {
/**
* BootScreen constructor
*
* Create a new <code>BootScreen</code> with specific width and height.
*
* @param width Screen canvas width.
* @param height Screen canvas height.
* @param width {number} Screen canvas width.
* @param height {number} Screen canvas height.
*/
constructor(game:Game) {
+2 -3
View File
@@ -12,11 +12,10 @@ module Phaser {
/**
* PauseScreen constructor
*
* Create a new <code>PauseScreen</code> with specific width and height.
*
* @param width Screen canvas width.
* @param height Screen canvas height.
* @param width {number} Screen canvas width.
* @param height {number} Screen canvas height.
*/
constructor(game: Game, width: number, height: number) {