diff options
author | Joris Guyonvarch | 2015-03-07 15:12:02 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-07 15:12:02 +0100 |
commit | 17a58e0c4c67f27d87635bf1b2ca50fb11795ad3 (patch) | |
tree | 8de99cdf0b4021ca6db6920537e7d0fa250e90bc /src/Step.elm | |
parent | 336816d2e8ab4afff1562123dfde61bf3a68e61c (diff) |
Organizing source code with subdirectories
Diffstat (limited to 'src/Step.elm')
-rw-r--r-- | src/Step.elm | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/Step.elm b/src/Step.elm deleted file mode 100644 index dd340a5..0000000 --- a/src/Step.elm +++ /dev/null @@ -1,50 +0,0 @@ -module Step where - -import List -import Keyboard (KeyCode) -import Char (fromCode, toCode) - -import Vec2 (..) -import Game (..) -import Player (..) -import Cloud (..) -import Geometry (..) -import Player (playerSpeed) -import Point (pointSpeed, pointMove, pointAwayDist) -import Physics (getNewPosAndSpeed) -import CloudStep (cloudStep) -import Config (otherConfig) -import Input (Input) - -step : Input -> Game -> Game -step {dir, inputKeysDown, delta} {time, keysDown, score, player, cloud, bestScore, seed} = - let hostilePoints = cloud.points (otherConfig player.config) - in if(playerPointsCollision time player hostilePoints) then - let newBestScore = if(score > bestScore) then score else bestScore - in initialGame seed player.pos player.config newBestScore - else - let newTime = time + delta - newPlayer = playerStep delta dir (newKeyCode keysDown inputKeysDown) player - (newCloud, addScore, newSeed) = cloudStep time seed newPlayer cloud - in { time = newTime - , keysDown = inputKeysDown - , score = score + addScore - , player = newPlayer - , cloud = newCloud - , bestScore = bestScore - , seed = newSeed - } - -playerStep : Float -> Vec2 -> (KeyCode -> Bool) -> Player -> Player -playerStep dt dir newKey player = - 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 playerSize pos - , speed = speed - , config = newConfig - } - -newKeyCode : List KeyCode -> List KeyCode -> KeyCode -> Bool -newKeyCode lastKeyCodes newKeyCodes keyCode = - let contains = not << List.isEmpty << List.filter (\kc -> kc == keyCode) - in not (contains lastKeyCodes) && (contains newKeyCodes) |