aboutsummaryrefslogtreecommitdiff
path: root/src/Update/CloudUpdate.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/Update/CloudUpdate.elm')
-rw-r--r--src/Update/CloudUpdate.elm15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Update/CloudUpdate.elm b/src/Update/CloudUpdate.elm
index e209ced..1fbb9d3 100644
--- a/src/Update/CloudUpdate.elm
+++ b/src/Update/CloudUpdate.elm
@@ -25,7 +25,7 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} currentScore =
if time > lastSpawn + spawn then
let (newPoint1, seed') = getNewPoint time boardSize seed currentScore
(newPoint2, seed'') = getNewPoint time boardSize seed' currentScore
- in ( { points config =
+ in ( { points = \config ->
if(config == player.config)
then
newPoint1 :: presentAndNotCaughtPoints
@@ -37,7 +37,7 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} currentScore =
, seed''
)
else
- ( { points config =
+ ( { points = \config ->
if(config == player.config) then
presentAndNotCaughtPoints
else
@@ -61,7 +61,7 @@ getNewPoint time boardSize seed currentScore =
in ( { initTime = time
, initPos = initPos
, initDest = initDest
- , move initTime initPos initDest time =
+ , move = \initTime initPos initDest time ->
let delta = time - initTime
move = (currentLevel currentScore).move initPos initDest delta
in initPos `add` move
@@ -78,10 +78,15 @@ pointInitPos boardSize seed =
pointDestination : Vec2 -> Seed -> (Vec2, Seed)
pointDestination boardSize seed =
- let ([r1, r2, r3, r4], seed') = generateMany 4 floatGen seed
- in ( randomBoardPosition boardSize (r1, r2) (r3, r4)
+ case generateMany 4 floatGen seed of
+ ([r1, r2, r3, r4], seed') ->
+ ( randomBoardPosition boardSize (r1, r2) (r3, r4)
, seed'
)
+ _ ->
+ ( randomBoardPosition boardSize (0, 0) (0, 0)
+ , seed
+ )
generateMany : Int -> Generator a -> Seed -> (List a, Seed)
generateMany count gen seed =