aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-02-05 08:53:20 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-02-05 08:53:20 +0000
commitf8e1b62244f011c971763c1ec60d1ff99184fac7 (patch)
tree7c317e1fe8a8c3578fdd39b6fa46434d07c93bc2 /src
parentfd63beed174dcbcdcc7fead7d734a53d65d060e1 (diff)
downloadspace-plat-hs-f8e1b62244f011c971763c1ec60d1ff99184fac7.tar.gz
space-plat-hs-f8e1b62244f011c971763c1ec60d1ff99184fac7.zip
Simplified (jump is needed)
Diffstat (limited to 'src')
-rw-r--r--src/Game/Entities.hs7
1 files changed, 3 insertions, 4 deletions
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}