-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPlayState.hs
More file actions
75 lines (56 loc) · 1.3 KB
/
PlayState.hs
File metadata and controls
75 lines (56 loc) · 1.3 KB
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
module Play.PlayState
( PlayState (PlayState)
, level
, balls
, drawnWalls
, DocState (DocShownFor, DocDone)
, docState
, drawing
, future
, paused
, playLevel
, initBall
, Ball (Ball)
, pos
, vel
, theta
, omega
, radius
, DrawState (Drawing, NotDrawing) ) where
import Graphics.Gloss.Data.Vector
import Level.Level
data PlayState = PlayState {
level :: Level
, balls :: [Ball]
, drawnWalls :: [Wall]
, docState :: DocState
, drawing :: DrawState
, future :: Bool
, paused :: Bool
} deriving (Show)
data Ball = Ball {
pos :: Vector
, vel :: Vector
, theta :: Float
, omega :: Float
, radius :: Float
} deriving (Show)
data DocState = DocShownFor Float | DocDone
deriving (Show)
data DrawState = Drawing Wall | NotDrawing
deriving (Show)
playLevel :: Level -> PlayState
playLevel l = PlayState {
level = l
, balls = [initBall l]
, drawnWalls = []
, docState = DocShownFor 0
, drawing = NotDrawing
, future = False
, paused = False }
initBall :: Level -> Ball
initBall l = Ball { pos = spawn l
, vel = (0, 0)
, theta = 0
, omega = 0
, radius = 20 }