Removed un-used file and tidying up.

This commit is contained in:
photonstorm 2017-06-27 15:24:49 +01:00
parent e688c8758f
commit 9fd9d30baf
3 changed files with 3 additions and 77 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '4e29a680-5b3b-11e7-beb8-2fd7d9854f0e'
build: '1eea1a70-5b41-11e7-93a3-65e728ed48e6'
};
module.exports = CHECKSUM;

View file

@ -1,73 +0,0 @@
var Clamp = require('../../math/Clamp');
var UpdateVelocity = function (body, delta)
{
var vel = body.vel.x;
var accel = body.accel.x;
var friction = body.friction.x;
var max = body.maxVel.x;
var frictionDelta;
// X
if (accel)
{
body.vel.x = Clamp(vel + accel * delta, -max, max);
}
else if (friction)
{
frictionDelta = friction * delta;
if (vel - frictionDelta > 0)
{
body.vel.x = vel - frictionDelta;
}
else if (vel + frictionDelta < 0)
{
body.vel.x = vel + frictionDelta;
}
else
{
body.vel.x = 0;
}
}
else
{
body.vel.x = Clamp(vel, -max, max);
}
vel = body.vel.y;
accel = body.accel.y;
friction = body.friction.y;
max = body.maxVel.y;
// Y
if (accel)
{
body.vel.y = Clamp(vel + accel * delta, -max, max);
}
else if (friction)
{
frictionDelta = friction * delta;
if (vel - frictionDelta > 0)
{
body.vel.y = vel - frictionDelta;
}
else if (vel + frictionDelta < 0)
{
body.vel.y = vel + frictionDelta;
}
else
{
body.vel.y = 0;
}
}
else
{
body.vel.y = Clamp(vel, -max, max);
}
return body;
};
module.exports = UpdateVelocity;

View file

@ -52,13 +52,12 @@ var World = new Class({
// Update all bodies
this.bodies.iterate(function (body) {
this.bodies.iterate(function (body)
{
if (body.enabled)
{
body.update(delta);
}
});
// Run collision against them all