aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Entities/Common.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-02-26 00:06:40 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-02-26 00:06:40 +0000
commitb3e0ace3ca198cacd8d77c6ca0f2c457826dee63 (patch)
treed55b86d8347da910dd166f44b99e5b072f217c2d /src/Game/Entities/Common.hs
parentc5b11b2c3acfd701fe5689bf0666a9adcbde8e4e (diff)
downloadspace-plat-hs-b3e0ace3ca198cacd8d77c6ca0f2c457826dee63.tar.gz
space-plat-hs-b3e0ace3ca198cacd8d77c6ca0f2c457826dee63.zip
Revisited the game over sequence
Diffstat (limited to 'src/Game/Entities/Common.hs')
-rw-r--r--src/Game/Entities/Common.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Game/Entities/Common.hs b/src/Game/Entities/Common.hs
index 251dbb4..ca5eb78 100644
--- a/src/Game/Entities/Common.hs
+++ b/src/Game/Entities/Common.hs
@@ -20,6 +20,8 @@ import SDL (($~))
toSpriteSet :: Dir -> Int
toSpriteSet DirRight = 0
toSpriteSet DirLeft = 1
+-- not really a direction
+toSpriteSet Dying = 2
-- | Return the number of frames available on the entity's sprite for current direction.
frameLimit :: Entity -> Int
@@ -32,7 +34,8 @@ collision :: IORef Entity -> Int -> Collision
collision playerRef otherHeight other = do
player <- readIORef playerRef
pure $
- player.x + 4 < other.x + 12
+ player.dir /= Dying
+ && player.x + 4 < other.x + 12
&& other.x + 4 < player.x + 12
&& player.y + otherHeight - 4 < other.y + otherHeight
&& other.y + 4 < player.y + 24