mirror of
https://github.com/wassname/phaser.git
synced 2026-09-11 12:31:29 +08:00
More docs coming on.
This commit is contained in:
+36
-6
@@ -8,13 +8,12 @@
|
||||
/**
|
||||
* Phaser Group constructor.
|
||||
* @class Phaser.Group
|
||||
* @classdesc An Animation instance contains a single animation and the controls to play it.
|
||||
* It is created by the AnimationManager, consists of Animation.Frame objects and belongs to a single Game Object such as a Sprite.
|
||||
* @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Description} parent - Description.
|
||||
* @param {string} name - The unique name for this animation, used in playback commands.
|
||||
* @param {bool} useStage - Description.
|
||||
* @param {boolean} useStage - Description.
|
||||
*/
|
||||
Phaser.Group = function (game, parent, name, useStage) {
|
||||
|
||||
@@ -67,7 +66,7 @@ Phaser.Group = function (game, parent, name, useStage) {
|
||||
this.type = Phaser.GROUP;
|
||||
|
||||
/**
|
||||
* @property {bool} exists - Description.
|
||||
* @property {boolean} exists - Description.
|
||||
* @default
|
||||
*/
|
||||
this.exists = true;
|
||||
@@ -87,6 +86,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method add
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
* @return {Description} Description.
|
||||
*/
|
||||
@@ -112,6 +112,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method addAt
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
* @param {Description} index - Description.
|
||||
* @return {Description} Description.
|
||||
@@ -138,6 +139,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method getAt
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} index - Description.
|
||||
* @return {Description} Description.
|
||||
*/
|
||||
@@ -151,6 +153,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method create
|
||||
* @memberOf Phaser.Group
|
||||
* @param {number} x - Description.
|
||||
* @param {number} y - Description.
|
||||
* @param {string} key - Description.
|
||||
@@ -182,9 +185,10 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method swap
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child1 - Description.
|
||||
* @param {Description} child2 - Description.
|
||||
* @return {bool} Description.
|
||||
* @return {boolean} Description.
|
||||
*/
|
||||
swap: function (child1, child2) {
|
||||
|
||||
@@ -310,6 +314,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method bringToTop
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
* @return {Description} Description.
|
||||
*/
|
||||
@@ -329,6 +334,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method getIndex
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
* @return {Description} Description.
|
||||
*/
|
||||
@@ -342,6 +348,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method replace
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} oldChild - Description.
|
||||
* @param {Description} newChild - Description.
|
||||
*/
|
||||
@@ -373,6 +380,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method setProperty
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
* @param {array} key - An array of values that will be set.
|
||||
* @param {Description} value - Description.
|
||||
@@ -436,6 +444,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method setAll
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} key - Description.
|
||||
* @param {Description} value - Description.
|
||||
* @param {Description} checkAlive - Description.
|
||||
@@ -474,6 +483,7 @@ Phaser.Group.prototype = {
|
||||
* Group.addAll('x', 10) will add 10 to the child.x value.
|
||||
*
|
||||
* @method addAll
|
||||
* @memberOf Phaser.Group
|
||||
* @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.
|
||||
@@ -490,6 +500,7 @@ Phaser.Group.prototype = {
|
||||
* Group.subAll('x', 10) will minus 10 from the child.x value.
|
||||
*
|
||||
* @method subAll
|
||||
* @memberOf Phaser.Group
|
||||
* @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.
|
||||
@@ -506,6 +517,7 @@ Phaser.Group.prototype = {
|
||||
* Group.multiplyAll('x', 2) will x2 the child.x value.
|
||||
*
|
||||
* @method multiplyAll
|
||||
* @memberOf Phaser.Group
|
||||
* @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.
|
||||
@@ -522,6 +534,7 @@ Phaser.Group.prototype = {
|
||||
* Group.divideAll('x', 2) will half the child.x value.
|
||||
*
|
||||
* @method divideAll
|
||||
* @memberOf Phaser.Group
|
||||
* @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.
|
||||
@@ -538,6 +551,7 @@ Phaser.Group.prototype = {
|
||||
* 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
|
||||
* @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.
|
||||
@@ -570,6 +584,7 @@ Phaser.Group.prototype = {
|
||||
* 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
|
||||
* @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.
|
||||
*/
|
||||
@@ -601,9 +616,10 @@ Phaser.Group.prototype = {
|
||||
* 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
|
||||
* @param {Description} callback - Description.
|
||||
* @param {Description} callbackContext - Description.
|
||||
* @param {bool} checkExists - Description.
|
||||
* @param {boolean} checkExists - Description.
|
||||
*/
|
||||
forEach: function (callback, callbackContext, checkExists) {
|
||||
|
||||
@@ -639,6 +655,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method forEachAlive
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} callback - Description.
|
||||
* @param {Description} callbackContext - Description.
|
||||
*/
|
||||
@@ -671,6 +688,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method forEachDead
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} callback - Description.
|
||||
* @param {Description} callbackContext - Description.
|
||||
*/
|
||||
@@ -702,6 +720,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
|
||||
* @param {Description} state - Description.
|
||||
* @return {Any} The first child, or null if none found.
|
||||
*/
|
||||
@@ -737,6 +756,7 @@ Phaser.Group.prototype = {
|
||||
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
|
||||
*
|
||||
* @method getFirstAlive
|
||||
* @memberOf Phaser.Group
|
||||
* @return {Any} The first alive child, or null if none found.
|
||||
*/
|
||||
getFirstAlive: function () {
|
||||
@@ -766,6 +786,7 @@ Phaser.Group.prototype = {
|
||||
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
|
||||
*
|
||||
* @method getFirstDead
|
||||
* @memberOf Phaser.Group
|
||||
* @return {Any} The first dead child, or null if none found.
|
||||
*/
|
||||
getFirstDead: function () {
|
||||
@@ -794,6 +815,7 @@ Phaser.Group.prototype = {
|
||||
* Call this function to find out how many members of the group are alive.
|
||||
*
|
||||
* @method countLiving
|
||||
* @memberOf Phaser.Group
|
||||
* @return {number} The number of children flagged as alive. Returns -1 if Group is empty.
|
||||
*/
|
||||
countLiving: function () {
|
||||
@@ -824,6 +846,7 @@ Phaser.Group.prototype = {
|
||||
* Call this function to find out how many members of the group are dead.
|
||||
*
|
||||
* @method countDead
|
||||
* @memberOf Phaser.Group
|
||||
* @return {number} The number of children flagged as dead. Returns -1 if Group is empty.
|
||||
*/
|
||||
countDead: function () {
|
||||
@@ -853,6 +876,8 @@ Phaser.Group.prototype = {
|
||||
/**
|
||||
* Returns a member at random from the group.
|
||||
*
|
||||
* @method getRandom
|
||||
* @memberOf Phaser.Group
|
||||
* @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.
|
||||
@@ -875,6 +900,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method remove
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} child - Description.
|
||||
*/
|
||||
remove: function (child) {
|
||||
@@ -889,6 +915,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method removeAll
|
||||
* @memberOf Phaser.Group
|
||||
*/
|
||||
removeAll: function () {
|
||||
|
||||
@@ -913,6 +940,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method removeBetween
|
||||
* @memberOf Phaser.Group
|
||||
* @param {Description} startIndex - Description.
|
||||
* @param {Description} endIndex - Description.
|
||||
*/
|
||||
@@ -941,6 +969,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method destroy
|
||||
* @memberOf Phaser.Group
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
@@ -960,6 +989,7 @@ Phaser.Group.prototype = {
|
||||
* Description.
|
||||
*
|
||||
* @method dump
|
||||
* @memberOf Phaser.Group
|
||||
*/
|
||||
dump: function (full) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user