aboutsummaryrefslogtreecommitdiff
path: root/src/Update
diff options
context:
space:
mode:
Diffstat (limited to 'src/Update')
-rw-r--r--src/Update/CloudUpdate.elm16
-rw-r--r--src/Update/Update.elm2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/Update/CloudUpdate.elm b/src/Update/CloudUpdate.elm
index cd4ff52..e209ced 100644
--- a/src/Update/CloudUpdate.elm
+++ b/src/Update/CloudUpdate.elm
@@ -11,20 +11,20 @@ import Model.Board exposing (boardDiagonal)
import Model.Point exposing (..)
import Model.Cloud exposing (..)
import Model.Config exposing (..)
+import Model.Level exposing (..)
import Utils.Geometry exposing (..)
-import Utils.Physics exposing (getMove, getWaveMove)
-cloudUpdate : Float -> Vec2 -> Seed -> Player -> Cloud -> (Cloud, Int, Seed)
-cloudUpdate time boardSize seed player {points, spawn, lastSpawn} =
+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
addScore = (List.length pointsToCatch) - (List.length presentAndNotCaughtPoints)
presentOtherPoints = presentPoints time boardSize (points (otherConfig player.config))
(newCloud, seed') =
if time > lastSpawn + spawn then
- let (newPoint1, seed') = getNewPoint time boardSize seed
- (newPoint2, seed'') = getNewPoint time boardSize seed'
+ let (newPoint1, seed') = getNewPoint time boardSize seed currentScore
+ (newPoint2, seed'') = getNewPoint time boardSize seed' currentScore
in ( { points config =
if(config == player.config)
then
@@ -54,8 +54,8 @@ presentPoints time boardSize points =
let isPresent point = (distance (pointMove point time) originVec) < (pointAwayDist boardSize)
in List.filter isPresent points
-getNewPoint : Float -> Vec2 -> Seed -> (Point, Seed)
-getNewPoint time boardSize seed =
+getNewPoint : Float -> Vec2 -> Seed -> Int -> (Point, Seed)
+getNewPoint time boardSize seed currentScore =
let (initPos, seed') = pointInitPos boardSize seed
(initDest, seed'') = pointDestination boardSize seed'
in ( { initTime = time
@@ -63,7 +63,7 @@ getNewPoint time boardSize seed =
, initDest = initDest
, move initTime initPos initDest time =
let delta = time - initTime
- move = getWaveMove (pointSpeed delta) (initDest `sub` initPos) 50 50
+ move = (currentLevel currentScore).move initPos initDest delta
in initPos `add` move
}
, seed''
diff --git a/src/Update/Update.elm b/src/Update/Update.elm
index 97cf6e3..e173aaa 100644
--- a/src/Update/Update.elm
+++ b/src/Update/Update.elm
@@ -36,7 +36,7 @@ update input game =
}
else
let newPlayer = playerStep input.delta game.boardSize input.dir (newKeyCode game.keysDown input.inputKeysDown) game.player
- (newCloud, addScore, newSeed) = cloudUpdate game.time game.boardSize game.seed newPlayer game.cloud
+ (newCloud, addScore, newSeed) = cloudUpdate game.time game.boardSize game.seed newPlayer game.cloud game.currentScore
in
{ game
| time <- game.time + input.delta