fixed wrong motion state constants in phaser p2 body

This commit is contained in:
Georgios Kaleadis 2014-03-19 22:56:26 +01:00
parent 22b472ba4d
commit 5b78c5c46e

View file

@ -1232,20 +1232,20 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "static", {
get: function () {
return (this.data.motionState === Phaser.Physics.P2.STATIC);
return (this.data.motionState === Phaser.Physics.P2.Body.STATIC);
},
set: function (value) {
if (value && this.data.motionState !== Phaser.Physics.P2.STATIC)
if (value && this.data.motionState !== Phaser.Physics.P2.Body.STATIC)
{
this.data.motionState = Phaser.Physics.P2.STATIC;
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
this.mass = 0;
}
else if (!value && this.data.motionState === Phaser.Physics.P2.STATIC)
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.STATIC)
{
this.data.motionState = Phaser.Physics.P2.DYNAMIC;
this.data.motionState = Phaser.Physics.P2.Body.DYNAMIC;
if (this.mass === 0)
{
@ -1265,24 +1265,24 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "dynamic", {
get: function () {
return (this.data.motionState === Phaser.Physics.P2.DYNAMIC);
return (this.data.motionState === Phaser.Physics.P2.Body.DYNAMIC);
},
set: function (value) {
if (value && this.data.motionState !== Phaser.Physics.P2.DYNAMIC)
if (value && this.data.motionState !== Phaser.Physics.P2.Body.DYNAMIC)
{
this.data.motionState = Phaser.Physics.P2.DYNAMIC;
this.data.motionState = Phaser.Physics.P2.Body.DYNAMIC;
if (this.mass === 0)
{
this.mass = 1;
}
}
else if (!value && this.data.motionState === Phaser.Physics.P2.DYNAMIC)
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.DYNAMIC)
{
this.data.motionState = Phaser.Physics.P2.STATIC;
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
this.mass = 0;
}
@ -1298,20 +1298,20 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "kinematic", {
get: function () {
return (this.data.motionState === Phaser.Physics.P2.KINEMATIC);
return (this.data.motionState === Phaser.Physics.P2.Body.KINEMATIC);
},
set: function (value) {
if (value && this.data.motionState !== Phaser.Physics.P2.KINEMATIC)
if (value && this.data.motionState !== Phaser.Physics.P2.Body.KINEMATIC)
{
this.data.motionState = Phaser.Physics.P2.KINEMATIC;
this.data.motionState = Phaser.Physics.P2.Body.KINEMATIC;
this.mass = 4;
}
else if (!value && this.data.motionState === Phaser.Physics.P2.KINEMATIC)
else if (!value && this.data.motionState === Phaser.Physics.P2.Body.KINEMATIC)
{
this.data.motionState = Phaser.Physics.P2.STATIC;
this.data.motionState = Phaser.Physics.P2.Body.STATIC;
this.mass = 0;
}