From cf6fc8b7cb8b108e5778481070944acb13513b5d Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 16 Feb 2023 21:16:20 +0000 Subject: Adjusted map collision --- src/Game/Entities.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 -- cgit v1.2.3