aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Entities.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-02-16 21:16:20 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-02-16 21:16:20 +0000
commitcf6fc8b7cb8b108e5778481070944acb13513b5d (patch)
treee9fe9829acce434d9bc67f2bf2ce1a2767637440 /src/Game/Entities.hs
parent1d68ac340c28792b2b498e204ef123730d901443 (diff)
downloadspace-plat-hs-cf6fc8b7cb8b108e5778481070944acb13513b5d.tar.gz
space-plat-hs-cf6fc8b7cb8b108e5778481070944acb13513b5d.zip
Adjusted map collision
Diffstat (limited to 'src/Game/Entities.hs')
-rw-r--r--src/Game/Entities.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs
index 95d9626..9152175 100644
--- a/src/Game/Entities.hs
+++ b/src/Game/Entities.hs
@@ -241,8 +241,8 @@ updateVertical isBlocked jump down e
-- 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
| down
- && not (isBlocked (e.x + 2) (e.y + 24 + 8))
- && not (isBlocked (e.x + 12) (e.y + 24 + 8)) =
+ && not (isBlocked (e.x + 4) (e.y + 24 + 8))
+ && not (isBlocked (e.x + 10) (e.y + 24 + 8)) =
e {gravity = gravityDown, frame = jumpFrame, y = e.y + 1}
| otherwise = e
@@ -251,9 +251,9 @@ applyGravity isBlocked v e
| v == 0 = e
-- hit the floor
| isGoingDown
- && (isBlocked (e.x + 2) (e.y + 24) || isBlocked (e.x + 12) (e.y + 24))
- && not (isBlocked (e.x + 2) (e.y + 23))
- && not (isBlocked (e.x + 12) (e.y + 23)) =
+ && (isBlocked (e.x + 4) (e.y + 24) || isBlocked (e.x + 10) (e.y + 24))
+ && not (isBlocked (e.x + 4) (e.y + 23))
+ && not (isBlocked (e.x + 10) (e.y + 23)) =
e {jumping = False, gravity = gravityOff, delay = 0}
| otherwise = applyGravity isBlocked (v - 1) e {y = e.y + change}
where
@@ -263,7 +263,7 @@ applyGravity isBlocked v e
updateGravity :: IsBlocked -> Entity -> Entity
updateGravity isBlocked e
| current > gravityOff = applyGravity isBlocked (gravityTable !! current) e {gravity = new}
- | not (isBlocked (e.x + 2) (e.y + 24) || isBlocked (e.x + 12) (e.y + 24)) = e {gravity = gravityDown, frame = jumpFrame}
+ | not (isBlocked (e.x + 4) (e.y + 24) || isBlocked (e.x + 10) (e.y + 24)) = e {gravity = gravityDown, frame = jumpFrame}
| otherwise = e
where
current = e.gravity