aboutsummaryrefslogtreecommitdiff
path: root/src/Update/Update.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/Update.elm
parent1cf6bc1ad9209e4f3f2fcbc129f2577e74e94c99 (diff)
Make the player bigger with each point
Diffstat (limited to 'src/Update/Update.elm')
-rw-r--r--src/Update/Update.elm16
1 files changed, 8 insertions, 8 deletions
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