Added Body.updateCallback

This commit is contained in:
Richard Davey 2017-08-17 03:15:02 +01:00
parent a481f75e31
commit d8991c5bc5
2 changed files with 8 additions and 1 deletions

View file

@ -58,6 +58,8 @@ var Body = new Class({
this.debugShowBody = world.defaults.debugShowBody;
this.debugShowVelocity = world.defaults.debugShowVelocity;
this.debugBodyColor = world.defaults.bodyDebugColor;
this.updateCallback;
// min 44 deg, max 136 deg
this.slopeStanding = { min: 0.767944870877505, max: 2.3736477827122884 };
@ -135,6 +137,11 @@ var Body = new Class({
graphic.lineBetween(x, y, x + this.vel.x, y + this.vel.y);
}
}
if (this.updateCallback)
{
this.updateCallback(this);
}
},
skipHash: function ()

View file

@ -210,7 +210,7 @@ var World = new Class({
}
}
// Run collision against them all now they're in the new positions from the udpate
// Run collision against them all now they're in the new positions from the update
for (i = 0; i < len; i++)
{