From d5ec91d4d01db6f4d476522d5b14e116435ebb7d Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sun, 15 Mar 2015 20:15:19 +0100 Subject: Displaying the last score in elm graphics instead of in helm html --- src/Update/CloudUpdate.elm | 4 ++-- src/Update/Update.elm | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Update') diff --git a/src/Update/CloudUpdate.elm b/src/Update/CloudUpdate.elm index 9863650..1988b7f 100644 --- a/src/Update/CloudUpdate.elm +++ b/src/Update/CloudUpdate.elm @@ -21,7 +21,7 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} = 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''') = + (newCloud, seed') = if time > lastSpawn + spawn then let (newPoint1, seed') = getNewPoint time boardSize seed (newPoint2, seed'') = getNewPoint time boardSize seed' @@ -47,7 +47,7 @@ cloudUpdate time boardSize seed player {points, spawn, lastSpawn} = } , seed ) - in (newCloud, addScore, seed''') + in (newCloud, addScore, seed') presentPoints : Float -> Vec2 -> List Point -> List Point presentPoints time boardSize points = diff --git a/src/Update/Update.elm b/src/Update/Update.elm index 2183d97..2be00b0 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -30,15 +30,14 @@ update input game = | time <- 0 , currentScore <- 0 , cloud <- initCloud - , rounds <- game.rounds `List.append` [Round game.time game.currentScore] + , rounds <- (Round game.time game.currentScore) :: game.rounds } else - let newTime = game.time + input.delta - newPlayer = playerStep input.delta game.boardSize input.dir (newKeyCode game.keysDown input.inputKeysDown) game.player + 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 in { game - | time <- newTime + | time <- game.time + input.delta , keysDown <- input.inputKeysDown , currentScore <- game.currentScore + addScore , player <- newPlayer -- cgit v1.2.3