From 6462e18527ddf005fb60f776828b3977d6ee8a25 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Tue, 19 Mar 2019 23:21:06 +0000 Subject: [PATCH] Gravity vars --- src/physics/arcade/World.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/physics/arcade/World.js b/src/physics/arcade/World.js index 00ff00094..767944b6f 100644 --- a/src/physics/arcade/World.js +++ b/src/physics/arcade/World.js @@ -1187,13 +1187,14 @@ var World = new Class({ if (body.allowGravity) { - // var worldBlocked = body.worldBlocked; + var gravityX = (this.gravity.x + body.gravity.x) * delta; + var gravityY = (this.gravity.y + body.gravity.y) * delta; - body._gx = (this.gravity.x + body.gravity.x) * delta; - body._gy = (this.gravity.y + body.gravity.y) * delta; + velocityX += gravityX; + velocityY += gravityY; - velocityX += body._gx; - velocityY += body._gy; + body._gx = gravityX; + body._gy = gravityY; } if (accelerationX)