From f8e1b62244f011c971763c1ec60d1ff99184fac7 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 5 Feb 2023 08:53:20 +0000 Subject: Simplified (jump is needed) --- src/Game/Entities.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Game') diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs index 1203f55..b232854 100644 --- a/src/Game/Entities.hs +++ b/src/Game/Entities.hs @@ -83,12 +83,11 @@ updateHorizontal left right e updateVertical :: Bool -> Bool -> Entity -> Entity updateVertical jump down e - | gravity /= gravityOff = e - | jump && not down = e {eGravity = gravityUp, eFrame = jumpFrame} + | not jump || gravity /= gravityOff = e + | not down = e {eGravity = gravityUp, eFrame = jumpFrame} -- go down a 8 pixel tall platform; not ideal to have these values hardcoded here -- but to be fair, the player height/width is hardcoded as well - | jump - && down + | down && not (isBlocked (x + 2) (y + 24 + 8)) && not (isBlocked (x + 12) (y + 24 + 8)) = applyGravity 8 e {eGravity = gravityDown, eFrame = jumpFrame, eY = eY e + 1} -- cgit v1.2.3