From beecc1e2af08f81f5cb5d2ebb93aaef59b20fcd5 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 5 Mar 2023 11:42:56 +0000 Subject: Exit stage WIP --- src/Game/Entities.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/Game/Entities.hs') diff --git a/src/Game/Entities.hs b/src/Game/Entities.hs index 2810fcf..2cfdd76 100644 --- a/src/Game/Entities.hs +++ b/src/Game/Entities.hs @@ -1,4 +1,14 @@ -module Game.Entities (Entities, Entity, mkEntities, updateAll, render, renderVisible, playerPosition) where +module Game.Entities + ( Entities, + Entity, + mkEntities, + addExit, + updateAll, + render, + renderVisible, + playerPosition, + ) +where import Control.Monad import Data.Bits (Bits (..)) @@ -9,6 +19,7 @@ import qualified Game.Controller as C import Game.Entities.Common import Game.Entities.Const import Game.Entities.Effect +import Game.Entities.Exit import Game.Entities.Pickup import Game.Entities.Player import Game.Entities.Robot @@ -42,6 +53,13 @@ playerPosition (Entities _ _ entities) = where player = head entities +addExit :: Entities -> IO Entities +addExit es = do + exit <- mkExit es.sprites x y (collision es.player 24) + pure es {entities = es.entities ++ [exit]} + where + (x, y) = playerPosition es + updateAll :: Entities -> GS.State -> IO (Entities, GS.State) updateAll es state = do -- update the player first (including the reference) -- cgit v1.2.3