1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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]
}
|