From 2258ef984fefde41711d4c883baf582b7e581155 Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 30 Dec 2015 13:35:01 +0100 Subject: Make the player bigger with each point --- src/Model/Player.elm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/Model/Player.elm') 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 -- cgit v1.2.3