diff options
Diffstat (limited to 'src/Model/Game.elm')
-rw-r--r-- | src/Model/Game.elm | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Model/Game.elm b/src/Model/Game.elm new file mode 100644 index 0000000..4ef5d89 --- /dev/null +++ b/src/Model/Game.elm @@ -0,0 +1,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 + } |