mirror of
https://github.com/wassname/phaser.git
synced 2026-07-27 11:25:30 +08:00
Updating all files to adhere to the JSHint settings and fixing lots of documentation errors on the way.
This commit is contained in:
@@ -104,7 +104,7 @@ GridBroadphase.prototype.getCollisionPairs = function(world){
|
||||
}
|
||||
} else if(si instanceof Plane){
|
||||
// Put in all bins for now
|
||||
if(bi.angle == 0){
|
||||
if(bi.angle === 0){
|
||||
var y = bi.position[1];
|
||||
for(var j=0; j!==Nbins && ymin+binsizeY*(j-1)<y; j++){
|
||||
for(var k=0; k<nx; k++){
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(iscs.length == 0) return [p.slice(0)];
|
||||
if(iscs.length === 0) return [p.slice(0)];
|
||||
var comp = function(u,v) {return PolyK._P.dist(a,u) - PolyK._P.dist(a,v); }
|
||||
iscs.sort(comp);
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
ps = PolyK._getPoints(ps, ind1, ind0);
|
||||
i0.flag = i1.flag = false;
|
||||
iscs.splice(0,2);
|
||||
if(iscs.length == 0) pgs.push(ps);
|
||||
if(iscs.length === 0) pgs.push(ps);
|
||||
}
|
||||
else { dir++; iscs.reverse(); }
|
||||
if(dir>1) break;
|
||||
@@ -402,7 +402,7 @@
|
||||
var day = (a1.y-a2.y), dby = (b1.y-b2.y);
|
||||
|
||||
var Den = dax*dby - day*dbx;
|
||||
if (Den == 0) return null; // parallel
|
||||
if (Den === 0) return null; // parallel
|
||||
|
||||
var A = (a1.x * a2.y - a1.y * a2.x);
|
||||
var B = (b1.x * b2.y - b1.y * b2.x);
|
||||
@@ -424,7 +424,7 @@
|
||||
var day = (a1.y-a2.y), dby = (b1.y-b2.y);
|
||||
|
||||
var Den = dax*dby - day*dbx;
|
||||
if (Den == 0) return null; // parallel
|
||||
if (Den === 0) return null; // parallel
|
||||
|
||||
var A = (a1.x * a2.y - a1.y * a2.x);
|
||||
var B = (b1.x * b2.y - b1.y * b2.x);
|
||||
|
||||
@@ -167,7 +167,7 @@ function Body(options){
|
||||
* var kinematicBody = new Body();
|
||||
* kinematicBody.motionState = Body.KINEMATIC;
|
||||
*/
|
||||
this.motionState = this.mass == 0 ? Body.STATIC : Body.DYNAMIC;
|
||||
this.motionState = this.mass === 0 ? Body.STATIC : Body.DYNAMIC;
|
||||
|
||||
/**
|
||||
* Bounding circle radius
|
||||
|
||||
@@ -404,7 +404,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
this._mapData = tilemapLayer.getTiles(sprite.body.x, sprite.body.y, sprite.body.width, sprite.body.height, true);
|
||||
|
||||
if (this._mapData.length == 0)
|
||||
if (this._mapData.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -448,12 +448,12 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -563,7 +563,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group1.length == 0 || group2.length == 0)
|
||||
if (group1.length === 0 || group2.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -620,7 +620,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
this._maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + this.OVERLAP_BIAS;
|
||||
|
||||
if (body1.deltaX() == 0 && body2.deltaX() == 0)
|
||||
if (body1.deltaX() === 0 && body2.deltaX() === 0)
|
||||
{
|
||||
// They overlap but neither of them are moving
|
||||
body1.embedded = true;
|
||||
@@ -631,7 +631,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving right and/or Body2 is moving left
|
||||
this._overlap = body1.x + body1.width - body2.x;
|
||||
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.right == false || body2.allowCollision.left == false)
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.right === false || body2.allowCollision.left === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving left and/or Body2 is moving right
|
||||
this._overlap = body1.x - body2.width - body2.x;
|
||||
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.left == false || body2.allowCollision.right == false)
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.left === false || body2.allowCollision.right === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
this._maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + this.OVERLAP_BIAS;
|
||||
|
||||
if (body1.deltaY() == 0 && body2.deltaY() == 0)
|
||||
if (body1.deltaY() === 0 && body2.deltaY() === 0)
|
||||
{
|
||||
// They overlap but neither of them are moving
|
||||
body1.embedded = true;
|
||||
@@ -739,7 +739,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving down and/or Body2 is moving up
|
||||
this._overlap = body1.y + body1.height - body2.y;
|
||||
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.down == false || body2.allowCollision.up == false)
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.down === false || body2.allowCollision.up === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -754,7 +754,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving up and/or Body2 is moving down
|
||||
this._overlap = body1.y - body2.height - body2.y;
|
||||
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.up == false || body2.allowCollision.down == false)
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.up === false || body2.allowCollision.down === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -852,7 +852,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
separateTileX: function (body, tile, separate) {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (body.immovable || body.deltaX() == 0 || Phaser.Rectangle.intersects(body.hullX, tile) == false)
|
||||
if (body.immovable || body.deltaX() === 0 || Phaser.Rectangle.intersects(body.hullX, tile) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -867,8 +867,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving left
|
||||
this._overlap = tile.right - body.hullX.x;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.left == false || tile.tile.collideRight == false)
|
||||
if (body.allowCollision.left == false || tile.tile.collideRight == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.left === false || tile.tile.collideRight === false)
|
||||
if (body.allowCollision.left === false || tile.tile.collideRight === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -882,8 +882,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving right
|
||||
this._overlap = body.hullX.right - tile.x;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.right == false || tile.tile.collideLeft == false)
|
||||
if (body.allowCollision.right == false || tile.tile.collideLeft == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.right === false || tile.tile.collideLeft === false)
|
||||
if (body.allowCollision.right === false || tile.tile.collideLeft === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -907,7 +907,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.x = body.x - this._overlap;
|
||||
}
|
||||
|
||||
if (body.bounce.x == 0)
|
||||
if (body.bounce.x === 0)
|
||||
{
|
||||
body.velocity.x = 0;
|
||||
}
|
||||
@@ -938,7 +938,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
separateTileY: function (body, tile, separate) {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (body.immovable || body.deltaY() == 0 || Phaser.Rectangle.intersects(body.hullY, tile) == false)
|
||||
if (body.immovable || body.deltaY() === 0 || Phaser.Rectangle.intersects(body.hullY, tile) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -953,8 +953,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving up
|
||||
this._overlap = tile.bottom - body.hullY.y;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.up == false || tile.tile.collideDown == false)
|
||||
if (body.allowCollision.up == false || tile.tile.collideDown == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.up === false || tile.tile.collideDown === false)
|
||||
if (body.allowCollision.up === false || tile.tile.collideDown === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -968,8 +968,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving down
|
||||
this._overlap = body.hullY.bottom - tile.y;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.down == false || tile.tile.collideUp == false)
|
||||
if (body.allowCollision.down == false || tile.tile.collideUp == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.down === false || tile.tile.collideUp === false)
|
||||
if (body.allowCollision.down === false || tile.tile.collideUp === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -993,7 +993,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.y = body.y - this._overlap;
|
||||
}
|
||||
|
||||
if (body.bounce.y == 0)
|
||||
if (body.bounce.y === 0)
|
||||
{
|
||||
body.velocity.y = 0;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
this.updateHulls();
|
||||
}
|
||||
|
||||
if (this.skipQuadTree == false && this.allowCollision.none == false && this.sprite.visible && this.sprite.alive)
|
||||
if (this.skipQuadTree === false && this.allowCollision.none === false && this.sprite.visible && this.sprite.alive)
|
||||
{
|
||||
this.quadTreeIDs = [];
|
||||
this.quadTreeIndex = -1;
|
||||
@@ -582,7 +582,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
|
||||
* The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
|
||||
* @method bottom
|
||||
* @return {number}
|
||||
**/
|
||||
*/
|
||||
get: function () {
|
||||
return this.y + this.height;
|
||||
},
|
||||
@@ -591,7 +591,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
|
||||
* The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
|
||||
* @method bottom
|
||||
* @param {number} value
|
||||
**/
|
||||
*/
|
||||
set: function (value) {
|
||||
|
||||
if (value <= this.y)
|
||||
@@ -618,7 +618,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
|
||||
* However it does affect the width property.
|
||||
* @method right
|
||||
* @return {number}
|
||||
**/
|
||||
*/
|
||||
get: function () {
|
||||
return this.x + this.width;
|
||||
},
|
||||
@@ -628,7 +628,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
|
||||
* However it does affect the width property.
|
||||
* @method right
|
||||
* @param {number} value
|
||||
**/
|
||||
*/
|
||||
set: function (value) {
|
||||
|
||||
if (value <= this.x)
|
||||
|
||||
Reference in New Issue
Block a user