-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.hs
99 lines (86 loc) · 1.74 KB
/
Model.hs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
module Model where
import Graphics.UI.SDL as SDL
import Graphics.UI.SDL.TTF as TTF
import Data.Word
import Data.Tiled
import System.Random
data Direction = None | Up | Down | Left | Right
deriving Eq
data Speed = Stop | Slow | Fast
deriving Eq
data Position = Position {
xVal :: Float,
yVal :: Float
}
data Mode = Walking | Fight | AfterFight
deriving (Eq, Show)
data EnemyType = Rat | Slime
data Enemy = Enemy {
enemyName :: String,
enemyType :: EnemyType,
maxhp :: Int,
hp :: Int,
maxmp :: Int,
mp :: Int,
level :: Int,
curAnimation :: Animation,
enemyPos :: Position
}
data Graphics = Graphics {
tileSurface :: Surface,
fightbg :: Surface,
menubg :: Surface,
menumarker :: Surface,
enemyfire :: Surface,
explosion :: Surface,
walkDownSprite :: Surface,
hitSprite :: Surface,
ratSprite :: Surface
}
data Menu = Menu {
name :: String,
choice :: Int,
labels :: [String],
menuPos :: Position
}
data GameState = GameState{
gameActive :: Bool,
animations :: [Animation],
time :: Word32,
player :: Player,
currentMap :: TiledMap,
cameraPos :: Position,
gameMode :: Mode,
rng :: StdGen,
nextFight :: Int,
gx :: Graphics,
menu :: Menu,
hasMenu :: Bool,
fnt :: Font,
actions :: [String],
enemies :: [Enemy],
t :: Word32,
agents :: [Agent]
}
data Animation = Animation {
sheet :: Surface,
width :: Int,
height :: Int,
frameCount :: Int,
imageTime :: Int,
lastSwitchTime :: Word32,
currentImage :: Int,
animPos :: Position,
expire :: Maybe(Word32)
}
data Player = Player {
moveDirection :: Direction,
speed :: Speed,
playerPos :: Position,
animation :: Animation
}
data Agent = Agent {
agentName :: String,
agentPos :: Position,
agentImage :: Surface
}