aboutsummaryrefslogtreecommitdiff
path: root/src/Game/Entities.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-03-05 11:42:56 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-03-09 12:21:05 +0000
commitbeecc1e2af08f81f5cb5d2ebb93aaef59b20fcd5 (patch)
treef0d1947e0369fdf59a1f626f953c778884873cc0 /src/Game/Entities.hs
parentee50719de81145b5859d957da722cf183e0c8c60 (diff)
downloadspace-plat-hs-beecc1e2af08f81f5cb5d2ebb93aaef59b20fcd5.tar.gz
space-plat-hs-beecc1e2af08f81f5cb5d2ebb93aaef59b20fcd5.zip
Exit stage WIP
Diffstat (limited to 'src/Game/Entities.hs')
-rw-r--r--src/Game/Entities.hs20
1 files changed, 19 insertions, 1 deletions
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)