diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-07-02 18:47:11 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-07-02 18:47:11 +0100 |
commit | a9178b3cb2d84711f99319afcf417979a38ab2d9 (patch) | |
tree | 48306900f17270f40d5d69a10015458300f1064d | |
parent | a964aa028d462d66e50754c7eeef4519fa93d892 (diff) |
gravity is a bummer
-rw-r--r-- | api.lua | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1943,9 +1943,18 @@ local falling = function(self, pos) -- floating in water (or falling) local v = self.object:getvelocity() - if v.y > self.fall_speed then + if v.y > 0 then - -- fall downwards + -- apply gravity when moving up + self.object:setacceleration({ + x = 0, + y = -10, + z = 0 + }) + + elseif v.y <= 0 and v.y > self.fall_speed then + + -- fall downwards at set speed self.object:setacceleration({ x = 0, y = self.fall_speed, |