Fix jshint issues in src/physics/p2

This commit is contained in:
Christian Wesselhoeft 2014-03-22 23:31:26 -07:00
parent b375daa3f6
commit 1c286c1ae5
12 changed files with 39 additions and 41 deletions

View file

@ -134,7 +134,7 @@ Phaser.Physics.P2.Body = function (game, sprite, x, y, mass) {
/**
* @property {Phaser.Physics.P2.BodyDebug} debugBody - Reference to the debug body.
*/
this.debugBody = null
this.debugBody = null;
// Set-up the default shape
if (sprite)
@ -763,7 +763,7 @@ Phaser.Physics.P2.Body.prototype = {
this.debugBody.destroy();
}
this.debugBody = null
this.debugBody = null;
this.sprite = null;
@ -1136,28 +1136,26 @@ Phaser.Physics.P2.Body.prototype = {
if (fixtureData.circle)
{
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius))
shape.collisionGroup = fixtureData.filter.categoryBits
shape.collisionMask = fixtureData.filter.maskBits
shape.sensor = fixtureData.isSensor
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius));
shape.collisionGroup = fixtureData.filter.categoryBits;
shape.collisionMask = fixtureData.filter.maskBits;
shape.sensor = fixtureData.isSensor;
var offset = p2.vec2.create();
offset[0] = this.world.pxmi(fixtureData.circle.position[0] - this.sprite.width/2)
offset[1] = this.world.pxmi(fixtureData.circle.position[1] - this.sprite.height/2)
offset[0] = this.world.pxmi(fixtureData.circle.position[0] - this.sprite.width/2);
offset[1] = this.world.pxmi(fixtureData.circle.position[1] - this.sprite.height/2);
this.data.addShape(shape, offset);
generatedShapes.push(shape)
generatedShapes.push(shape);
}
else
{
polygons = fixtureData.polygons;
var polygons = fixtureData.polygons;
var cm = p2.vec2.create();
for (var i = 0; i < polygons.length; i++)
{
shapes = polygons[i];
var shapes = polygons[i];
var vertices = [];
for (var s = 0; s < shapes.length; s += 2)
@ -1755,7 +1753,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "debug", {
if (value && !this.debugBody)
{
// This will be added to the global space
this.debugBody = new Phaser.Physics.P2.BodyDebug(this.game, this.data)
this.debugBody = new Phaser.Physics.P2.BodyDebug(this.game, this.data);
}
else if (!value && this.debugBody)
{

View file

@ -31,7 +31,7 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
debugPolygons: false,
lineWidth: 1,
alpha: 0.5
}
};
this.settings = Phaser.Utils.extend(defaultSettings, settings);
@ -51,16 +51,16 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
*/
this.canvas = new Phaser.Graphics(game);
this.canvas.alpha = this.settings.alpha
this.canvas.alpha = this.settings.alpha;
this.add(this.canvas);
this.draw();
}
};
Phaser.Physics.P2.BodyDebug.prototype = Object.create(Phaser.Group.prototype)
Phaser.Physics.P2.BodyDebug.prototype.constructor = Phaser.Physics.P2.BodyDebug
Phaser.Physics.P2.BodyDebug.prototype = Object.create(Phaser.Group.prototype);
Phaser.Physics.P2.BodyDebug.prototype.constructor = Phaser.Physics.P2.BodyDebug;
Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
@ -106,7 +106,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
if (obj instanceof p2.Body && obj.shapes.length)
{
var l = obj.shapes.length
var l = obj.shapes.length;
i = 0;
@ -149,7 +149,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
this.drawRectangle(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, angle, child.width * this.ppu, child.height * this.ppu, lineColor, color, lw);
}
i++
i++;
}
}
@ -424,4 +424,4 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
}
})
});

View file

@ -18,4 +18,4 @@ Phaser.Physics.P2.CollisionGroup = function (bitmask) {
*/
this.mask = bitmask;
}
};

View file

@ -58,7 +58,7 @@ Phaser.Physics.P2.ContactMaterial = function (materialA, materialB, options) {
p2.ContactMaterial.call(this, materialA, materialB, options);
}
};
Phaser.Physics.P2.ContactMaterial.prototype = Object.create(p2.ContactMaterial.prototype);
Phaser.Physics.P2.ContactMaterial.prototype.constructor = Phaser.Physics.P2.ContactMaterial;

View file

@ -34,7 +34,7 @@ Phaser.Physics.P2.DistanceConstraint = function (world, bodyA, bodyB, distance,
p2.DistanceConstraint.call(this, bodyA, bodyB, distance, maxForce);
}
};
Phaser.Physics.P2.DistanceConstraint.prototype = Object.create(p2.DistanceConstraint.prototype);
Phaser.Physics.P2.DistanceConstraint.prototype.constructor = Phaser.Physics.P2.DistanceConstraint;

View file

@ -35,7 +35,7 @@ Phaser.Physics.P2.GearConstraint = function (world, bodyA, bodyB, angle, ratio)
p2.GearConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.GearConstraint.prototype = Object.create(p2.GearConstraint.prototype);
Phaser.Physics.P2.GearConstraint.prototype.constructor = Phaser.Physics.P2.GearConstraint;

View file

@ -39,7 +39,7 @@ Phaser.Physics.P2.LockConstraint = function (world, bodyA, bodyB, offset, angle,
p2.LockConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.LockConstraint.prototype = Object.create(p2.LockConstraint.prototype);
Phaser.Physics.P2.LockConstraint.prototype.constructor = Phaser.Physics.P2.LockConstraint;

View file

@ -21,7 +21,7 @@ Phaser.Physics.P2.Material = function (name) {
p2.Material.call(this);
}
};
Phaser.Physics.P2.Material.prototype = Object.create(p2.Material.prototype);
Phaser.Physics.P2.Material.prototype.constructor = Phaser.Physics.P2.Material;

View file

@ -44,7 +44,7 @@ Phaser.Physics.P2.PrismaticConstraint = function (world, bodyA, bodyB, lockRotat
p2.PrismaticConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.PrismaticConstraint.prototype = Object.create(p2.PrismaticConstraint.prototype);
Phaser.Physics.P2.PrismaticConstraint.prototype.constructor = Phaser.Physics.P2.PrismaticConstraint;

View file

@ -37,7 +37,7 @@ Phaser.Physics.P2.RevoluteConstraint = function (world, bodyA, pivotA, bodyB, pi
p2.RevoluteConstraint.call(this, bodyA, pivotA, bodyB, pivotB, maxForce);
}
};
Phaser.Physics.P2.RevoluteConstraint.prototype = Object.create(p2.RevoluteConstraint.prototype);
Phaser.Physics.P2.RevoluteConstraint.prototype.constructor = Phaser.Physics.P2.RevoluteConstraint;

View file

@ -67,7 +67,7 @@ Phaser.Physics.P2.Spring = function (world, bodyA, bodyB, restLength, stiffness,
p2.Spring.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.Spring.prototype = Object.create(p2.Spring.prototype);
Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;

View file

@ -279,7 +279,7 @@ Phaser.Physics.P2.prototype = {
if (object.hasOwnProperty('body') && object.body === null)
{
object.body = new Phaser.Physics.P2.Body(this.game, object, object.x, object.y, 1);
object.body.debug = debug
object.body.debug = debug;
object.anchor.set(0.5);
}