From 04c2839de5b860ff0efe957e2be9a21dbdfa329a Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 9 Feb 2023 23:43:14 +0000 Subject: Make entities in the map module This needs to be reviewed. --- src/Game.hs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/Game.hs') diff --git a/src/Game.hs b/src/Game.hs index 8cdd45f..dcb5eab 100644 --- a/src/Game.hs +++ b/src/Game.hs @@ -45,13 +45,6 @@ data Env = Env defaultRenderRect :: SDL.Rectangle CInt defaultRenderRect = SDL.Rectangle (SDL.P $ V2 0 0) (V2 windowWidth windowHeight) -spawn :: M.Map -> S.SpriteSheet -> IORef C.Controls -> IO [E.Entity] -spawn m sprites controls = - traverse toEntity $ M.objects m - where - toEntity :: M.MapObject -> IO E.Entity - toEntity (M.PlayerEntity x y) = E.mkPlayer sprites x y controls (M.isBlocked m) - main :: IO () main = do SDL.initialize [SDL.InitVideo, SDL.InitGameController] @@ -77,7 +70,7 @@ main = do map' <- M.load "data/map.json" tsTexture sprites <- S.load "data/sprites.json" ssTexture entities <- newIORef $ E.mkEntities sprites - spawned <- spawn map' sprites controls + spawned <- M.mkEntities map' sprites controls entities $~ flip E.add spawned runReaderT gameLoop -- cgit v1.2.3