From e066422b950a06873efb6a884b47155c867b7acf Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 24 Feb 2023 22:51:42 +0000 Subject: Cleaned passing the collision detection function to the entities --- src/Game/Entities/Slime.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Game/Entities/Slime.hs') diff --git a/src/Game/Entities/Slime.hs b/src/Game/Entities/Slime.hs index d87f735..5ca6fe7 100644 --- a/src/Game/Entities/Slime.hs +++ b/src/Game/Entities/Slime.hs @@ -1,14 +1,13 @@ module Game.Entities.Slime (mkSlime) where import Data.Bits (Bits (..)) -import Data.IORef import Game.Entities.Common import Game.Entities.Const import Game.Entities.Types import qualified Game.Sprites as S -mkSlime :: S.SpriteSheet -> Int -> Int -> IORef Entity -> IsBlocked -> IO () -> IO Entity -mkSlime sprites x y playerRef isBlocked hitPlayer' = do +mkSlime :: S.SpriteSheet -> Int -> Int -> Collision -> IsBlocked -> IO () -> IO Entity +mkSlime sprites x y playerCollision isBlocked hitPlayer' = do s <- S.get sprites "slime" pure Entity @@ -21,7 +20,7 @@ mkSlime sprites x y playerRef isBlocked hitPlayer' = do gravity = gravityOff, dir = DirRight, sprite = s, - update = updateSlime (collision playerRef 16) isBlocked hitPlayer', + update = updateSlime playerCollision isBlocked hitPlayer', destroy = False, spawns = [] } -- cgit v1.2.3