mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Finish document for AnimationManager, Tile, FrameData, BootScreen, PauseScreen.
This commit is contained in:
+15
-10
@@ -18,10 +18,9 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AnimationManager constructor
|
* AnimationManager constructor
|
||||||
*
|
|
||||||
* Create a new <code>AnimationManager</code>.
|
* 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) {
|
constructor(game: Game, parent: Sprite) {
|
||||||
|
|
||||||
@@ -78,11 +77,11 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new animation.
|
* Add a new animation.
|
||||||
* @param name What this animation should be called (e.g. "run").
|
* @param name {string} 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 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 The speed in frames per second that the animation should play at (e.g. 60 fps).
|
* @param frameRate {number} 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 loop {boolean} Whether or not the animation is looped or just plays once.
|
||||||
* @param useNumericIndex Use number indexes instead of string indexes?
|
* @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) {
|
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 {
|
private validateFrames(frames: any[], useNumericIndex: bool): bool {
|
||||||
|
|
||||||
for (var i = 0; i < frames.length; i++)
|
for (var i = 0; i < frames.length; i++)
|
||||||
@@ -142,9 +147,9 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Play animation with specific name.
|
* Play animation with specific name.
|
||||||
* @param name The string name of the animation you want to play.
|
* @param name {string} The string name of the animation you want to play.
|
||||||
* @param frameRate FrameRate you want to specify instead of using default.
|
* @param frameRate {number} FrameRate you want to specify instead of using default.
|
||||||
* @param loop Whether or not the animation is looped or just plays once.
|
* @param loop {boolean} Whether or not the animation is looped or just plays once.
|
||||||
*/
|
*/
|
||||||
public play(name: string, frameRate?: number = null, loop?: bool) {
|
public play(name: string, frameRate?: number = null, loop?: bool) {
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ module Phaser {
|
|||||||
* Tile constructor
|
* Tile constructor
|
||||||
* Create a new <code>Tile</code>.
|
* Create a new <code>Tile</code>.
|
||||||
*
|
*
|
||||||
* @param tilemap the tilemap this tile belongs to.
|
* @param tilemap {Tilemap} the tilemap this tile belongs to.
|
||||||
* @param index The index of this tile type in the core map data.
|
* @param index {number} The index of this tile type in the core map data.
|
||||||
* @param width Width of the tile.
|
* @param width {number} Width of the tile.
|
||||||
* @param height Height of the tile.
|
* @param height number} Height of the tile.
|
||||||
*/
|
*/
|
||||||
constructor(game: Game, tilemap: Tilemap, index: number, width: number, height: number) {
|
constructor(game: Game, tilemap: Tilemap, index: number, width: number, height: number) {
|
||||||
|
|
||||||
@@ -121,10 +121,10 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set collision configs.
|
* Set collision configs.
|
||||||
* @param collision Bit field of flags. (see Tile.allowCollision)
|
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
|
||||||
* @param resetCollisions Reset collision flags before set.
|
* @param resetCollisions {boolean} Reset collision flags before set.
|
||||||
* @param separateX Enable seprate at x-axis.
|
* @param separateX {boolean} Enable seprate at x-axis.
|
||||||
* @param separateY Enable seprate at y-axis.
|
* @param separateY {boolean} Enable seprate at y-axis.
|
||||||
*/
|
*/
|
||||||
public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) {
|
public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) {
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new frame.
|
* Add a new frame.
|
||||||
* @param frame The frame you want to add.
|
* @param frame {Frame} The frame you want to add.
|
||||||
* @return {Frame=} The frame you just added.
|
* @return {Frame} The frame you just added.
|
||||||
*/
|
*/
|
||||||
public addFrame(frame: Frame): Frame {
|
public addFrame(frame: Frame): Frame {
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a frame by its index.
|
* Get a frame by its index.
|
||||||
* @param index Index of the frame you want to get.
|
* @param index {number} Index of the frame you want to get.
|
||||||
* @return {Frame=} The frame you want.
|
* @return {Frame} The frame you want.
|
||||||
*/
|
*/
|
||||||
public getFrame(index: number): Frame {
|
public getFrame(index: number): Frame {
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a frame by its name.
|
* Get a frame by its name.
|
||||||
* @param name Name of the frame you want to get.
|
* @param name {string} Name of the frame you want to get.
|
||||||
* @return {Frame=} The frame you want.
|
* @return {Frame} The frame you want.
|
||||||
*/
|
*/
|
||||||
public getFrameByName(name: string): Frame {
|
public getFrameByName(name: string): Frame {
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether there's a frame with given name.
|
* 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.
|
* @return {boolean} True if frame with given name found, otherwise return false.
|
||||||
*/
|
*/
|
||||||
public checkFrameName(name: string): bool {
|
public checkFrameName(name: string): bool {
|
||||||
@@ -103,10 +103,10 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ranges of frames in an array.
|
* Get ranges of frames in an array.
|
||||||
* @param start Start index of frames you want.
|
* @param start {number} Start index of frames you want.
|
||||||
* @param end End index of frames you want.
|
* @param end {number} End index of frames you want.
|
||||||
* @param output Optional, result will be added into this array.
|
* @param output {Frame[]} Optional, result will be added into this array.
|
||||||
* @return {array} Ranges of specific frames in an array.
|
* @return {Frame[]} Ranges of specific frames in an array.
|
||||||
*/
|
*/
|
||||||
public getFrameRange(start: number, end: number, output?: Frame[] = []): Frame[] {
|
public getFrameRange(start: number, end: number, output?: Frame[] = []): Frame[] {
|
||||||
|
|
||||||
@@ -121,8 +121,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all indexes of frames by giving their name.
|
* Get all indexes of frames by giving their name.
|
||||||
* @param output Optional, result will be added into this array.
|
* @param output {number[]} Optional, result will be added into this array.
|
||||||
* @return {array} Indexes of specific frames in an array.
|
* @return {number[]} Indexes of specific frames in an array.
|
||||||
*/
|
*/
|
||||||
public getFrameIndexes(output?: number[] = []): number[] {
|
public getFrameIndexes(output?: number[] = []): number[] {
|
||||||
|
|
||||||
@@ -139,8 +139,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all names of frames by giving their indexes.
|
* Get all names of frames by giving their indexes.
|
||||||
* @param output Optional, result will be added into this array.
|
* @param output {number[]} Optional, result will be added into this array.
|
||||||
* @return {array} Names of specific frames in an array.
|
* @return {number[]} Names of specific frames in an array.
|
||||||
*/
|
*/
|
||||||
public getFrameIndexesByName(input: string[]): number[] {
|
public getFrameIndexesByName(input: string[]): number[] {
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all frames in this frame data.
|
* 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[] {
|
public getAllFrames(): Frame[] {
|
||||||
return this._frames;
|
return this._frames;
|
||||||
@@ -168,8 +168,8 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All frames with specific ranges.
|
* Get All frames with specific ranges.
|
||||||
* @param range Ranges in an array.
|
* @param range {number[]} Ranges in an array.
|
||||||
* @return All frames in an array.
|
* @return {Frame[]} All frames in an array.
|
||||||
*/
|
*/
|
||||||
public getFrames(range: number[]) {
|
public getFrames(range: number[]) {
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BootScreen constructor
|
* BootScreen constructor
|
||||||
*
|
|
||||||
* Create a new <code>BootScreen</code> with specific width and height.
|
* Create a new <code>BootScreen</code> with specific width and height.
|
||||||
*
|
*
|
||||||
* @param width Screen canvas width.
|
* @param width {number} Screen canvas width.
|
||||||
* @param height Screen canvas height.
|
* @param height {number} Screen canvas height.
|
||||||
*/
|
*/
|
||||||
constructor(game:Game) {
|
constructor(game:Game) {
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ module Phaser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PauseScreen constructor
|
* PauseScreen constructor
|
||||||
*
|
|
||||||
* Create a new <code>PauseScreen</code> with specific width and height.
|
* Create a new <code>PauseScreen</code> with specific width and height.
|
||||||
*
|
*
|
||||||
* @param width Screen canvas width.
|
* @param width {number} Screen canvas width.
|
||||||
* @param height Screen canvas height.
|
* @param height {number} Screen canvas height.
|
||||||
*/
|
*/
|
||||||
constructor(game: Game, width: number, height: number) {
|
constructor(game: Game, width: number, height: number) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user