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/Pickup.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Game/Entities/Pickup.hs') diff --git a/src/Game/Entities/Pickup.hs b/src/Game/Entities/Pickup.hs index 8d8beb8..4aa7326 100644 --- a/src/Game/Entities/Pickup.hs +++ b/src/Game/Entities/Pickup.hs @@ -1,13 +1,12 @@ module Game.Entities.Pickup (mkBattery) where -import Data.IORef import Game.Entities.Common import Game.Entities.Const import Game.Entities.Types import qualified Game.Sprites as S -mkBattery :: S.SpriteSheet -> Int -> Int -> IORef Entity -> IO () -> IO Entity -mkBattery sprites x y playerRef collectedBattery' = do +mkBattery :: S.SpriteSheet -> Int -> Int -> Collision -> IO () -> IO Entity +mkBattery sprites x y playerCollision collectedBattery' = do s <- S.get sprites "battery" pure Entity @@ -20,7 +19,7 @@ mkBattery sprites x y playerRef collectedBattery' = do gravity = gravityOff, dir = DirRight, sprite = s, - update = updateBattery (collision playerRef 16) collectedBattery', + update = updateBattery playerCollision collectedBattery', destroy = False, spawns = [] } -- cgit v1.2.3