Skip to content

Commit 395e4d0

Browse files
committed
Cache vars
1 parent 69edda9 commit 395e4d0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,18 +963,19 @@ var Body = new Class({
963963
update: function (delta)
964964
{
965965
var velocity = this.velocity;
966+
var position = this.position;
966967

967968
if (this.moves)
968969
{
969970
this.world.updateMotion(this, delta);
970971

971-
this.position.x += this.getMoveX(velocity.x * delta);
972-
this.position.y += this.getMoveY(velocity.y * delta);
972+
position.x += this.getMoveX(velocity.x * delta);
973+
position.y += this.getMoveY(velocity.y * delta);
973974
}
974975

975976
// Calculate the delta
976-
this._dx = this.position.x - this.prev.x;
977-
this._dy = this.position.y - this.prev.y;
977+
this._dx = position.x - this.prev.x;
978+
this._dy = position.y - this.prev.y;
978979

979980
var worldBlocked = this.worldBlocked;
980981

0 commit comments

Comments
 (0)