mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Fix jshint issues in src/core
This commit is contained in:
parent
9faa27ce4f
commit
debb6bdcf9
9 changed files with 73 additions and 73 deletions
|
@ -313,7 +313,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
|||
|
||||
this._onBoot = function () {
|
||||
return _this.boot();
|
||||
}
|
||||
};
|
||||
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive')
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ Phaser.Group.prototype.add = function (child) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
|
||||
|
@ -247,7 +247,7 @@ Phaser.Group.prototype.addAt = function (child, index) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the child found at the given index within this Group.
|
||||
|
@ -267,7 +267,7 @@ Phaser.Group.prototype.getAt = function (index) {
|
|||
return this.getChildAt(index);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Automatically creates a new Phaser.Sprite object and adds it to the top of this Group.
|
||||
|
@ -312,7 +312,7 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group.
|
||||
|
@ -334,7 +334,7 @@ Phaser.Group.prototype.createMultiple = function (quantity, key, frame, exists)
|
|||
this.create(0, 0, key, frame, exists);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Internal method that re-applies all of the childrens Z values.
|
||||
|
@ -351,7 +351,7 @@ Phaser.Group.prototype.updateZ = function () {
|
|||
this.children[i].z = i;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object.
|
||||
|
@ -375,7 +375,7 @@ Phaser.Group.prototype.next = function () {
|
|||
this.cursor = this.children[this._cache[8]];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object.
|
||||
|
@ -399,7 +399,7 @@ Phaser.Group.prototype.previous = function () {
|
|||
this.cursor = this.children[this._cache[8]];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Swaps the position of two children in this Group. Both children must be in this Group.
|
||||
|
@ -420,7 +420,7 @@ Phaser.Group.prototype.swap = function (child1, child2) {
|
|||
|
||||
return result;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Brings the given child to the top of this Group so it renders above all other children.
|
||||
|
@ -439,7 +439,7 @@ Phaser.Group.prototype.bringToTop = function (child) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends the given child to the bottom of this Group so it renders below all other children.
|
||||
|
@ -458,7 +458,7 @@ Phaser.Group.prototype.sendToBack = function (child) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves the given child up one place in this Group unless it's already at the top.
|
||||
|
@ -482,7 +482,7 @@ Phaser.Group.prototype.moveUp = function (child) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves the given child down one place in this Group unless it's already at the top.
|
||||
|
@ -506,7 +506,7 @@ Phaser.Group.prototype.moveDown = function (child) {
|
|||
|
||||
return child;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Positions the child found at the given index within this Group to the given x and y coordinates.
|
||||
|
@ -528,7 +528,7 @@ Phaser.Group.prototype.xy = function (index, x, y) {
|
|||
this.getChildAt(index).y = y;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Reverses all children in this Group. Note that this does not propagate, only direct children are re-ordered.
|
||||
|
@ -540,7 +540,7 @@ Phaser.Group.prototype.reverse = function () {
|
|||
this.children.reverse();
|
||||
this.updateZ();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the index position of the given child in this Group. This should always match the childs z property.
|
||||
|
@ -553,7 +553,7 @@ Phaser.Group.prototype.getIndex = function (child) {
|
|||
|
||||
return this.children.indexOf(child);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.
|
||||
|
@ -589,7 +589,7 @@ Phaser.Group.prototype.replace = function (oldChild, newChild) {
|
|||
return temp;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the given property to the given value on the child. The operation controls the assignment of the value.
|
||||
|
@ -649,7 +649,7 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation) {
|
|||
else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set a property on a single child of this Group to a new value.
|
||||
|
@ -675,7 +675,7 @@ Phaser.Group.prototype.set = function (child, key, value, checkAlive, checkVisib
|
|||
this.setProperty(child, key, value, operation);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set the same property across all children of this Group to a new value.
|
||||
|
@ -708,7 +708,7 @@ Phaser.Group.prototype.setAll = function (key, value, checkAlive, checkVisible,
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set the same property across all children of this Group, and any child Groups, to a new value.
|
||||
|
@ -747,7 +747,7 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the amount to the given property on all children in this Group.
|
||||
|
@ -763,7 +763,7 @@ Phaser.Group.prototype.addAll = function (property, amount, checkAlive, checkVis
|
|||
|
||||
this.setAll(property, amount, checkAlive, checkVisible, 1);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Subtracts the amount from the given property on all children in this Group.
|
||||
|
@ -779,7 +779,7 @@ Phaser.Group.prototype.subAll = function (property, amount, checkAlive, checkVis
|
|||
|
||||
this.setAll(property, amount, checkAlive, checkVisible, 2);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Multiplies the given property by the amount on all children in this Group.
|
||||
|
@ -795,7 +795,7 @@ Phaser.Group.prototype.multiplyAll = function (property, amount, checkAlive, che
|
|||
|
||||
this.setAll(property, amount, checkAlive, checkVisible, 3);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Divides the given property by the amount on all children in this Group.
|
||||
|
@ -811,7 +811,7 @@ Phaser.Group.prototype.divideAll = function (property, amount, checkAlive, check
|
|||
|
||||
this.setAll(property, amount, checkAlive, checkVisible, 4);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calls a function on all of the children that have exists=true in this Group.
|
||||
|
@ -834,7 +834,7 @@ Phaser.Group.prototype.callAllExists = function (callback, existsValue) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a reference to a function that exists on a child of the Group based on the given callback array.
|
||||
|
@ -887,7 +887,7 @@ Phaser.Group.prototype.callbackFromArray = function (child, callback, length) {
|
|||
|
||||
return false;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that)
|
||||
|
@ -947,7 +947,7 @@ Phaser.Group.prototype.callAll = function (method, context) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The core preUpdate - as called by World.
|
||||
|
@ -971,7 +971,7 @@ Phaser.Group.prototype.preUpdate = function () {
|
|||
|
||||
return true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The core update - as called by World.
|
||||
|
@ -987,7 +987,7 @@ Phaser.Group.prototype.update = function () {
|
|||
this.children[i].update();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The core postUpdate - as called by World.
|
||||
|
@ -1010,7 +1010,7 @@ Phaser.Group.prototype.postUpdate = function () {
|
|||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
|
||||
|
@ -1042,7 +1042,7 @@ Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExist
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows you to call your own function on each member of this Group where child.exists=true. You must pass the callback and context in which it will run.
|
||||
|
@ -1060,7 +1060,7 @@ Phaser.Group.prototype.forEachExists = function (callback, callbackContext) {
|
|||
|
||||
this.iterate('exists', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run.
|
||||
|
@ -1078,7 +1078,7 @@ Phaser.Group.prototype.forEachAlive = function (callback, callbackContext) {
|
|||
|
||||
this.iterate('alive', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run.
|
||||
|
@ -1096,7 +1096,7 @@ Phaser.Group.prototype.forEachDead = function (callback, callbackContext) {
|
|||
|
||||
this.iterate('alive', false, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to sort the group according to a particular value and order.
|
||||
|
@ -1130,7 +1130,7 @@ Phaser.Group.prototype.sort = function (index, order) {
|
|||
|
||||
this.updateZ();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An internal helper function for the sort process.
|
||||
|
@ -1161,7 +1161,7 @@ Phaser.Group.prototype.ascendingSortHandler = function (a, b) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An internal helper function for the sort process.
|
||||
|
@ -1185,7 +1185,7 @@ Phaser.Group.prototype.descendingSortHandler = function (a, b) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match.
|
||||
|
@ -1242,7 +1242,7 @@ Phaser.Group.prototype.iterate = function (key, value, returnType, callback, cal
|
|||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to retrieve the first object with exists == (the given state) in the Group.
|
||||
|
@ -1260,7 +1260,7 @@ Phaser.Group.prototype.getFirstExists = function (state) {
|
|||
|
||||
return this.iterate('exists', state, Phaser.Group.RETURN_CHILD);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to retrieve the first object with alive === true in the group.
|
||||
|
@ -1273,7 +1273,7 @@ Phaser.Group.prototype.getFirstAlive = function () {
|
|||
|
||||
return this.iterate('alive', true, Phaser.Group.RETURN_CHILD);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to retrieve the first object with alive === false in the group.
|
||||
|
@ -1286,7 +1286,7 @@ Phaser.Group.prototype.getFirstDead = function () {
|
|||
|
||||
return this.iterate('alive', false, Phaser.Group.RETURN_CHILD);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the child at the top of this Group. The top is the one being displayed (rendered) above every other child.
|
||||
|
@ -1301,7 +1301,7 @@ Phaser.Group.prototype.getTop = function () {
|
|||
return this.children[this.children.length - 1];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the child at the bottom of this Group. The bottom is the one being displayed (rendered) below every other child.
|
||||
|
@ -1316,7 +1316,7 @@ Phaser.Group.prototype.getBottom = function () {
|
|||
return this.children[0];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to find out how many members of the group are alive.
|
||||
|
@ -1328,7 +1328,7 @@ Phaser.Group.prototype.countLiving = function () {
|
|||
|
||||
return this.iterate('alive', true, Phaser.Group.RETURN_TOTAL);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call this function to find out how many members of the group are dead.
|
||||
|
@ -1340,7 +1340,7 @@ Phaser.Group.prototype.countDead = function () {
|
|||
|
||||
return this.iterate('alive', false, Phaser.Group.RETURN_TOTAL);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a member at random from the group.
|
||||
|
@ -1362,7 +1362,7 @@ Phaser.Group.prototype.getRandom = function (startIndex, length) {
|
|||
|
||||
return this.game.math.getRandom(this.children, startIndex, length);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the given child from this Group and sets its group property to null.
|
||||
|
@ -1394,7 +1394,7 @@ Phaser.Group.prototype.remove = function (child) {
|
|||
|
||||
return true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all children from this Group, setting all group properties to null.
|
||||
|
@ -1422,7 +1422,7 @@ Phaser.Group.prototype.removeAll = function () {
|
|||
|
||||
this.cursor = null;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.
|
||||
|
@ -1460,7 +1460,7 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) {
|
|||
|
||||
this.updateZ();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
|
||||
|
@ -1506,7 +1506,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
|
|||
this.exists = false;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Phaser.Group#total
|
||||
|
|
|
@ -147,7 +147,7 @@ Phaser.LinkedList.prototype = {
|
|||
entity = entity.next;
|
||||
|
||||
}
|
||||
while(entity != this.last.next)
|
||||
while(entity != this.last.next);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", {
|
|||
|
||||
get: function () {
|
||||
|
||||
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement'])
|
||||
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement']);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ Phaser.Stage.prototype.preUpdate = function () {
|
|||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This is called automatically after the State.update, but before particles or plugins update.
|
||||
|
@ -127,7 +127,7 @@ Phaser.Stage.prototype.update = function () {
|
|||
this.children[i].update();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This is called automatically before the renderer runs and after the plugins have updated.
|
||||
|
@ -176,7 +176,7 @@ Phaser.Stage.prototype.postUpdate = function () {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a Game configuration object.
|
||||
|
@ -229,7 +229,7 @@ Phaser.Stage.prototype.parseConfig = function (config) {
|
|||
this.backgroundColor = config['backgroundColor'];
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialises the stage and adds the event listeners.
|
||||
|
@ -246,14 +246,14 @@ Phaser.Stage.prototype.boot = function () {
|
|||
|
||||
this._onChange = function (event) {
|
||||
return _this.visibilityChange(event);
|
||||
}
|
||||
};
|
||||
|
||||
Phaser.Canvas.setUserSelect(this.game.canvas, 'none');
|
||||
Phaser.Canvas.setTouchAction(this.game.canvas, 'none');
|
||||
|
||||
this.checkVisibility();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts a page visibility event listener running, or window.blur/focus if not supported by the browser.
|
||||
|
@ -294,7 +294,7 @@ Phaser.Stage.prototype.checkVisibility = function () {
|
|||
window.onblur = this._onChange;
|
||||
window.onfocus = this._onChange;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This method is called when the document visibility is changed.
|
||||
|
@ -331,7 +331,7 @@ Phaser.Stage.prototype.visibilityChange = function (event) {
|
|||
this.game.gameResumed(event);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the background color for the stage.
|
||||
|
@ -346,7 +346,7 @@ Phaser.Stage.prototype.setBackgroundColor = function(backgroundColor)
|
|||
var hex = this._backgroundColor.toString(16);
|
||||
hex = '000000'.substr(0, 6 - hex.length) + hex;
|
||||
this.backgroundColorString = '#' + hex;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Phaser.Stage#backgroundColor
|
||||
|
|
|
@ -34,7 +34,7 @@ Phaser.World = function (game) {
|
|||
*/
|
||||
this.camera = null;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Phaser.World.prototype = Object.create(Phaser.Group.prototype);
|
||||
Phaser.World.prototype.constructor = Phaser.World;
|
||||
|
@ -57,7 +57,7 @@ Phaser.World.prototype.boot = function () {
|
|||
|
||||
this.game.stage.addChild(this);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
|
||||
|
@ -90,7 +90,7 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
|
|||
|
||||
this.game.physics.setBoundsToWorld();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroyer of worlds.
|
||||
|
@ -102,7 +102,7 @@ Phaser.World.prototype.shutdown = function () {
|
|||
// World is a Group, so run a soft destruction on this and all children.
|
||||
this.destroy(true, true);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Phaser.World#width
|
||||
|
|
Loading…
Reference in a new issue