aboutsummaryrefslogtreecommitdiff
path: root/src/Update/CloudUpdate.elm
diff options
context:
space:
mode:
authorJoris2015-12-30 13:35:01 +0100
committerJoris2015-12-30 13:35:01 +0100
commit2258ef984fefde41711d4c883baf582b7e581155 (patch)
treea15cdae0c8a77a628ee49959037a1000687f3a2c /src/Update/CloudUpdate.elm
parent1cf6bc1ad9209e4f3f2fcbc129f2577e74e94c99 (diff)
Make the player bigger with each point
Diffstat (limited to 'src/Update/CloudUpdate.elm')
-rw-r--r--src/Update/CloudUpdate.elm30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Update/CloudUpdate.elm b/src/Update/CloudUpdate.elm
index 1fbb9d3..359f02c 100644
--- a/src/Update/CloudUpdate.elm
+++ b/src/Update/CloudUpdate.elm
@@ -15,16 +15,16 @@ import Model.Level exposing (..)
import Utils.Geometry exposing (..)
-cloudUpdate : Float -> Vec2 -> Seed -> Player -> Cloud -> Int -> (Cloud, Int, Seed)
-cloudUpdate time boardSize seed player {points, spawn, lastSpawn} currentScore =
- let pointsToCatch = presentPoints time boardSize (points player.config)
- presentAndNotCaughtPoints = List.filter (not << (playerPointCollision time player)) pointsToCatch
+cloudUpdate : Float -> Vec2 -> Seed -> Player -> Float -> Cloud -> Int -> (Cloud, Int, Seed)
+cloudUpdate elapsedTime boardSize seed player playerSize {points, spawn, lastSpawn} currentScore =
+ let pointsToCatch = presentPoints elapsedTime boardSize (points player.config)
+ presentAndNotCaughtPoints = List.filter (not << (playerPointCollision elapsedTime player playerSize)) pointsToCatch
addScore = (List.length pointsToCatch) - (List.length presentAndNotCaughtPoints)
- presentOtherPoints = presentPoints time boardSize (points (otherConfig player.config))
+ presentOtherPoints = presentPoints elapsedTime boardSize (points (otherConfig player.config))
(newCloud, seed') =
- if time > lastSpawn + spawn then
- let (newPoint1, seed') = getNewPoint time boardSize seed currentScore
- (newPoint2, seed'') = getNewPoint time boardSize seed' currentScore
+ if elapsedTime > lastSpawn + spawn then
+ let (newPoint1, seed') = getNewPoint elapsedTime boardSize seed currentScore
+ (newPoint2, seed'') = getNewPoint elapsedTime boardSize seed' currentScore
in ( { points = \config ->
if(config == player.config)
then
@@ -32,7 +32,7 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} currentScore =
else
newPoint2 :: presentOtherPoints
, spawn = spawn - sqrt(spawn) / 50
- , lastSpawn = time
+ , lastSpawn = elapsedTime
}
, seed''
)
@@ -50,19 +50,19 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} currentScore =
in (newCloud, addScore, seed')
presentPoints : Float -> Vec2 -> List Point -> List Point
-presentPoints time boardSize points =
- let isPresent point = (distance (pointMove point time) originVec) < (pointAwayDist boardSize)
+presentPoints elapsedTime boardSize points =
+ let isPresent point = (distance (pointMove point elapsedTime) originVec) < (pointAwayDist boardSize)
in List.filter isPresent points
getNewPoint : Float -> Vec2 -> Seed -> Int -> (Point, Seed)
-getNewPoint time boardSize seed currentScore =
+getNewPoint elapsedTime boardSize seed currentScore =
let (initPos, seed') = pointInitPos boardSize seed
(initDest, seed'') = pointDestination boardSize seed'
- in ( { initTime = time
+ in ( { initTime = elapsedTime
, initPos = initPos
, initDest = initDest
- , move = \initTime initPos initDest time ->
- let delta = time - initTime
+ , move = \initTime initPos initDest elapsedTime ->
+ let delta = elapsedTime - initTime
move = (currentLevel currentScore).move initPos initDest delta
in initPos `add` move
}