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
|
module Model.Game
( Game
, initialGame
) where
import Random (..)
import Keyboard (KeyCode)
import Model.Player (..)
import Model.Cloud (..)
import Model.Vec2 (Vec2)
import Model.Config (..)
type alias Game =
{ time : Float
, keysDown : List KeyCode
, score : Int
, player : Player
, cloud : Cloud
, bestScore : Int
, seed : Seed
}
initialGame : Seed -> Vec2 -> Config -> Int -> Game
initialGame seed playerPos config bestScore =
let initPlayer =
{ pos = playerPos
, speed =
{ x = 0
, y = 0
}
, config = config
}
in
{ time = 0
, keysDown = []
, score = 0
, player = initPlayer
, cloud = initCloud
, bestScore = bestScore
, seed = seed
}
|