diff options
author | Joris | 2015-12-30 13:35:01 +0100 |
---|---|---|
committer | Joris | 2015-12-30 13:35:01 +0100 |
commit | 2258ef984fefde41711d4c883baf582b7e581155 (patch) | |
tree | a15cdae0c8a77a628ee49959037a1000687f3a2c /src/Model/Player.elm | |
parent | 1cf6bc1ad9209e4f3f2fcbc129f2577e74e94c99 (diff) |
Make the player bigger with each point
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 |