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/Update/Update.elm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Update/Update.elm') diff --git a/src/Update/Update.elm b/src/Update/Update.elm index 9dc737f..2514aac 100644 --- a/src/Update/Update.elm +++ b/src/Update/Update.elm @@ -25,20 +25,20 @@ import Input exposing (Input) update : Input -> Game -> Game update input game = let hostilePoints = game.cloud.points (otherConfig game.player.config) - in if(playerPointsCollision game.time game.player hostilePoints) + in if(playerPointsCollision game.elapsedTime game.player (getPlayerSize game.currentScore) hostilePoints) then { game - | time = 0 + | elapsedTime = 0 , currentScore = 0 , cloud = initCloud - , rounds = (Round game.time game.currentScore) :: game.rounds + , rounds = (Round game.elapsedTime game.currentScore) :: game.rounds } 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 game.currentScore + let newPlayer = playerStep input.delta game.boardSize input.dir (newKeyCode game.keysDown input.inputKeysDown) game.player (getPlayerSize game.currentScore) + (newCloud, addScore, newSeed) = cloudUpdate game.elapsedTime game.boardSize game.seed newPlayer (getPlayerSize game.currentScore) game.cloud game.currentScore in { game - | time = game.time + input.delta + | elapsedTime = game.elapsedTime + input.delta , keysDown = input.inputKeysDown , currentScore = game.currentScore + addScore , player = newPlayer @@ -46,8 +46,8 @@ update input game = , seed = newSeed } -playerStep : Float -> Vec2 -> Vec2 -> (KeyCode -> Bool) -> Player -> Player -playerStep dt boardSize dir newKey player = +playerStep : Float -> Vec2 -> Vec2 -> (KeyCode -> Bool) -> Player -> Float -> Player +playerStep dt boardSize dir newKey player playerSize = let (pos, speed) = getNewPosAndSpeed dt dir playerSpeed (player.pos, player.speed) newConfig = if (newKey 69) then otherConfig player.config else player.config in { pos = inBoard boardSize playerSize pos -- cgit v1.2.3