From 44aafa287f12f459b0b3d346ce6a13754e7636e2 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 2 Aug 2023 18:49:45 +0100 Subject: Fix the name to be accurate --- src/Game/Entities/Player.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Game/Entities/Player.hs b/src/Game/Entities/Player.hs index 82e528a..72de1bb 100644 --- a/src/Game/Entities/Player.hs +++ b/src/Game/Entities/Player.hs @@ -38,13 +38,13 @@ updateHorizontal isBlocked left right e -- change direction first | left && e.dir /= DirLeft = e {dir = DirLeft, set = toSpriteSet DirLeft, delay = 0} | right && e.dir /= DirRight = e {dir = DirRight, set = toSpriteSet DirRight, delay = 0} - | left && isGoingDown = if isBlocked (e.x - 1) (e.y + 23) then e else e {x = e.x - 1} - | left && not isGoingDown = if isBlocked (e.x - 1) (e.y + 23) && isBlocked (e.x - 1) (e.y + 17) then e else e {x = e.x - 1} - | right && isGoingDown = if isBlocked (e.x + 17) (e.y + 23) then e else e {x = e.x + 1} - | right && not isGoingDown = if isBlocked (e.x + 17) (e.y + 23) && isBlocked (e.x + 17) (e.y + 17) then e else e {x = e.x + 1} + | left && isNotGoingDown = if isBlocked (e.x - 1) (e.y + 23) then e else e {x = e.x - 1} + | left && not isNotGoingDown = if isBlocked (e.x - 1) (e.y + 23) && isBlocked (e.x - 1) (e.y + 17) then e else e {x = e.x - 1} + | right && isNotGoingDown = if isBlocked (e.x + 17) (e.y + 23) then e else e {x = e.x + 1} + | right && not isNotGoingDown = if isBlocked (e.x + 17) (e.y + 23) && isBlocked (e.x + 17) (e.y + 17) then e else e {x = e.x + 1} | otherwise = e where - isGoingDown = e.gravity == gravityOff || e.gravity >= gravityDown + isNotGoingDown = e.gravity == gravityOff || e.gravity >= gravityDown updateVertical :: IsBlocked -> Bool -> Bool -> Entity -> Entity updateVertical isBlocked jump down e -- cgit v1.2.3