fix inertia

This commit is contained in:
assada 2024-06-03 00:34:03 +03:00
parent 4f6d0a6c24
commit 9cd5c1bd81
Signed by: assada
GPG Key ID: D4860A938E541F06

View File

@ -34,7 +34,7 @@ function Player:init(x, y)
-- Physics properties
self.fallSpeed = 0.05
self.xVelocity = 0
self.xVelocity = -0.5
self.yVelocity = self.fallSpeed
self.maxXSpeed = 2
self.maxYSpeed = 5
@ -67,6 +67,7 @@ function Player:handleInput()
if not playdate.buttonIsPressed(playdate.kButtonLeft) and not playdate.buttonIsPressed(playdate.kButtonRight) then
self.xVelocity = self.xVelocity * self.friction
Player.moveRight = false
self.animation:setState("down")
end
local isChangingDirection = false
@ -101,7 +102,6 @@ function Player:handleInput()
self.yInertia = self.yInertia - (acceleratedChange * 0.007)
else
self.yInertia = self.yInertia * self.friction
self.animation:setState("down")
end
end