diff options
Diffstat (limited to 'src/Model/Player.elm')
-rw-r--r-- | src/Model/Player.elm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Model/Player.elm b/src/Model/Player.elm index 2085aac..6858893 100644 --- a/src/Model/Player.elm +++ b/src/Model/Player.elm @@ -1,12 +1,13 @@ module Model.Player ( Player , initPlayer - , playerSize + , getPlayerSize , playerSpeed ) where import Model.Vec2 exposing (..) import Model.Config exposing (..) +import Model.Level as Level type alias Player = { pos : Vec2 @@ -21,8 +22,16 @@ initPlayer = , config = White } -playerSize : Float -playerSize = 15 +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 |