aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Entities
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-08-02 18:49:45 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-08-02 18:49:45 +0100
commit44aafa287f12f459b0b3d346ce6a13754e7636e2 (patch)
tree85c2e6b6efe51409ddd5cf9475fb8025744cb9f7 /src/Game/Entities
parent8ace5ad0b007438fd880852b83439a7816f4f494 (diff)
downloadspace-plat-hs-44aafa287f12f459b0b3d346ce6a13754e7636e2.tar.gz
space-plat-hs-44aafa287f12f459b0b3d346ce6a13754e7636e2.zip
Fix the name to be accurate
Diffstat (limited to 'src/Game/Entities')
-rw-r--r--src/Game/Entities/Player.hs10
1 files changed, 5 insertions, 5 deletions
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