diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-02-20 21:52:22 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-02-20 21:52:22 +0000 |
commit | ed585355b1f78de15885e803138a98b75ca2b1e2 (patch) | |
tree | da25f10539fa39ee284dc49ab9d5e53721bc008f /src/Game/Entities/Types.hs | |
parent | 92785d2df84e18953048a6537b71c824a2a4b288 (diff) | |
download | space-plat-hs-ed585355b1f78de15885e803138a98b75ca2b1e2.tar.gz space-plat-hs-ed585355b1f78de15885e803138a98b75ca2b1e2.zip |
Split entities in modules.
Diffstat (limited to 'src/Game/Entities/Types.hs')
-rw-r--r-- | src/Game/Entities/Types.hs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Game/Entities/Types.hs b/src/Game/Entities/Types.hs new file mode 100644 index 0000000..ed609d3 --- /dev/null +++ b/src/Game/Entities/Types.hs @@ -0,0 +1,46 @@ +module Game.Entities.Types + ( Dir (..), + Type (..), + Collision, + IsBlocked, + Entities (..), + Spawn (..), + Entity (..), + ) +where + +import Data.IORef +import qualified Game.Sprites as S +import qualified Game.State as GS + +data Dir = DirRight | DirLeft deriving (Eq) + +data Type = TypePlayer | TypePickup | TypeEffect | TypeEnemy + +type Collision = Entity -> IO Bool + +type IsBlocked = Int -> Int -> Bool + +data Entities = Entities + { sprites :: S.SpriteSheet, + player :: IORef Entity, + state :: IORef GS.State, + entities :: [Entity] + } + +data Spawn = DustEffectSpawn Int Int + +data Entity = Entity + { typ :: Type, + x :: Int, + y :: Int, + delay :: Int, + frame :: Int, + jumping :: Bool, + gravity :: Int, + dir :: Dir, + sprite :: S.Sprite, + update :: Entity -> IO Entity, + destroy :: Bool, + spawns :: [Spawn] + } |