aboutsummaryrefslogtreecommitdiff
path: root/src/Game.elm
blob: 4d682190f80f47f82ee07c9c7e3717edfbdf33ed (plain)
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
module Game where

import Random (..)

import Player (..)
import Cloud (..)
import Vec2 (Vec2)
import Config (..)
import Keyboard (KeyCode)

type alias Game =
  { time : Float
  , keysDown : List KeyCode
  , score : Int
  , player : Player
  , cloud : Cloud
  , bestScore : Int
  , seed : Seed
  }

initialGame : Seed -> Vec2 -> Int -> Game
initialGame seed playerPos bestScore =
  let initPlayer =
    { pos = playerPos
    , speed =
        { x = 0
        , y = 0
        }
    , config = White
    }
  in
    { time = 0
    , keysDown = []
    , score = 0
    , player = initPlayer
    , cloud = initCloud
    , bestScore = bestScore
    , seed = seed
    }