Skip to content

Commit 3d399f1

Browse files
committed
Removed the final few private vars from computeVelocity
1 parent c9939f8 commit 3d399f1

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/physics/arcade/World.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ Phaser.Physics.Arcade.prototype = {
191191
*/
192192
updateMotion: function (body) {
193193

194-
this._velocityDelta = this.computeVelocity(0, body, body.angularVelocity, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity;
195-
body.angularVelocity += this._velocityDelta;
194+
var velocityDelta = this.computeVelocity(0, body, body.angularVelocity, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity;
195+
body.angularVelocity += velocityDelta;
196196
body.rotation += (body.angularVelocity * this.game.time.physicsElapsed);
197197

198198
body.velocity.x = this.computeVelocity(1, body, body.velocity.x, body.acceleration.x, body.drag.x, body.maxVelocity.x);
@@ -215,13 +215,13 @@ Phaser.Physics.Arcade.prototype = {
215215
*/
216216
computeVelocity: function (axis, body, velocity, acceleration, drag, max) {
217217

218-
max = typeof max !== 'undefined' ? max : 10000;
218+
if (typeof max === 'undefined') { max = 10000 };
219219

220-
if (axis == 1 && body.allowGravity)
220+
if (axis === 1 && body.allowGravity)
221221
{
222222
velocity += (this.gravity.x + body.gravity.x) * this.game.time.physicsElapsed;
223223
}
224-
else if (axis == 2 && body.allowGravity)
224+
else if (axis === 2 && body.allowGravity)
225225
{
226226
velocity += (this.gravity.y + body.gravity.y) * this.game.time.physicsElapsed;
227227
}
@@ -232,15 +232,16 @@ Phaser.Physics.Arcade.prototype = {
232232
}
233233
else if (drag)
234234
{
235-
this._drag = drag * this.game.time.physicsElapsed;
235+
// var _drag = drag * this.game.time.physicsElapsed;
236+
drag *= this.game.time.physicsElapsed;
236237

237-
if (velocity - this._drag > 0)
238+
if (velocity - drag > 0)
238239
{
239-
velocity -= this._drag;
240+
velocity -= drag;
240241
}
241-
else if (velocity + this._drag < 0)
242+
else if (velocity + drag < 0)
242243
{
243-
velocity += this._drag;
244+
velocity += drag;
244245
}
245246
else
246247
{

0 commit comments

Comments
 (0)