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.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Game/Entities.hs') diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs index 291f10e..d265ff5 100644 --- a/src/Game/Entities.hs +++ b/src/Game/Entities.hs @@ -30,9 +30,9 @@ mkEntities sprites m controls stateRef = do pure $ Entities sprites playerRef stateRef (player : entities) where toEntity :: IORef Entity -> M.Object -> IO Entity - toEntity playerRef (M.SlimeEntity x y) = mkSlime sprites x y playerRef (M.isBlocked m) (hitPlayer stateRef) - toEntity playerRef (M.RobotEntity x y) = mkRobot sprites x y playerRef (M.isBlocked m) (hitPlayer stateRef) - toEntity playerRef (M.BatteryEntity x y) = mkBattery sprites x y playerRef (collectedBattery stateRef) + toEntity playerRef (M.SlimeEntity x y) = mkSlime sprites x y (collision playerRef 16) (M.isBlocked m) (hitPlayer stateRef) + toEntity playerRef (M.RobotEntity x y) = mkRobot sprites x y (collision playerRef 24) (M.isBlocked m) (hitPlayer stateRef) + toEntity playerRef (M.BatteryEntity x y) = mkBattery sprites x y (collision playerRef 16) (collectedBattery stateRef) toEntity _ (M.PlayerEntity _ _) = error "Player already processed" processSpawn :: S.SpriteSheet -> Spawn -> IO Entity -- cgit v1.2.3