blob: 685889345e962fd248f43c831f572902f8e1837a (
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
|
module Model.Player
( Player
, initPlayer
, getPlayerSize
, playerSpeed
) where
import Model.Vec2 exposing (..)
import Model.Config exposing (..)
import Model.Level as Level
type alias Player =
{ pos : Vec2
, speed : Vec2
, config : Config
}
initPlayer : Player
initPlayer =
{ pos = originVec
, speed = originVec
, config = White
}
getPlayerSize : Int -> Float
getPlayerSize score =
(levelCurve Level.levelScoreDuration 15 (Level.currentLevelScore score)) + 15
levelCurve : Int -> Int -> Int -> Float
levelCurve maxAbs maxOrd x =
let linear = toFloat x * toFloat maxOrd / toFloat maxAbs
n = 4
exp = toFloat x^n * toFloat maxOrd / toFloat maxAbs^n
in linear - exp
playerSpeed : Float -> Float
playerSpeed dt = dt / 200
|