aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-02-18 15:35:31 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-02-18 15:35:31 +0000
commitccd83b474cf99b1bea16316404c87b99c2de3fde (patch)
tree9bfa6488ab8c77edff9199435f3dd503666f46fd /src
parente854a1a40948833a3f341de9b1e6c9f3337b38a4 (diff)
downloadspace-plat-hs-ccd83b474cf99b1bea16316404c87b99c2de3fde.tar.gz
space-plat-hs-ccd83b474cf99b1bea16316404c87b99c2de3fde.zip
Slightly more readable
Diffstat (limited to 'src')
-rw-r--r--src/Game/Entities.hs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs
index f45ae1a..8decf07 100644
--- a/src/Game/Entities.hs
+++ b/src/Game/Entities.hs
@@ -216,17 +216,17 @@ updateSlime touchedPlayer isBlocked e = do
pure $ if touched then e {destroy = True} else updateMovement updated
where
updateMovement :: Entity -> Entity
- updateMovement e'
- | testBit e'.delay 1 = e'
- | e'.dir == DirLeft
- && (isBlocked (e'.x - 1) (e'.y + 15) || isBlocked (e'.x - 1) (e'.y + 10) || not (isBlocked (e'.x - 1) (e'.y + 16))) =
- e' {dir = DirRight}
- | e'.dir == DirLeft = e' {x = e'.x - 1}
- | e'.dir == DirRight
- && (isBlocked (e'.x + 16) (e'.y + 15) || isBlocked (e'.x + 16) (e'.y + 10) || not (isBlocked (e'.x + 16) (e'.y + 16))) =
- e' {dir = DirLeft}
- | e'.dir == DirRight = e' {x = e'.x + 1}
- | otherwise = e'
+ updateMovement ent
+ | testBit ent.delay 1 = ent
+ | ent.dir == DirLeft
+ && (isBlocked (ent.x - 1) (ent.y + 15) || isBlocked (ent.x - 1) (ent.y + 10) || not (isBlocked (ent.x - 1) (ent.y + 16))) =
+ ent {dir = DirRight}
+ | ent.dir == DirLeft = ent {x = ent.x - 1}
+ | ent.dir == DirRight
+ && (isBlocked (ent.x + 16) (ent.y + 15) || isBlocked (ent.x + 16) (ent.y + 10) || not (isBlocked (ent.x + 16) (ent.y + 16))) =
+ ent {dir = DirLeft}
+ | ent.dir == DirRight = ent {x = ent.x + 1}
+ | otherwise = ent
updateSlimeFrame :: Entity
updateSlimeFrame
| e.delay > 0 = e {delay = e.delay - 1}