Permalink
Browse files

Merge pull request #1 from digitalBush/elm-0.13-updates

Updates for breaking changes introduced in Elm 0.12 and 0.13
  • Loading branch information...
2 parents 7ab0411 + f8ca522 commit 6e7e99794329ebc9fd90033983f9439c3ccbd53c @digitalBush digitalBush committed Nov 9, 2014
Showing with 13 additions and 8 deletions.
  1. +3 −2 PewPew/Level.elm
  2. +5 −4 PewPew/Step.elm
  3. +5 −2 PewPew/View.elm
View
@@ -1,5 +1,6 @@
module PewPew.Level where
+import String
import PewPew.Model as Model
import PewPew.Utils as Utils
@@ -12,8 +13,8 @@ parseLine (row, chars) =
in chars
|> String.split ""
|> Utils.withIndex
- |> filter (nonBlank . snd)
- |> map (withRow . fst)
+ |> filter (nonBlank << snd)
+ |> map (withRow << fst)
asciiToEnemies: String -> [Model.Enemy]
View
@@ -1,5 +1,6 @@
module PewPew.Step where
+import List
import PewPew.Input (Input)
import PewPew.Model (..)
import PewPew.Utils as Utils
@@ -28,7 +29,7 @@ within x y a b =
except: [a] -> [a] -> [a]
except a b =
let inB x = any ((==) x) b
- in filter (not . inB) a
+ in filter (not << inB) a
--
@@ -106,14 +107,14 @@ stepEnemyFire t projectiles enemies =
|> map (tryEnemyFire (length enemies))
|> unzip
enemies'' = enemies' |> map (\enemy -> {enemy| lastFired <- enemy.lastFired + t})
- projectiles'' = (newProjectiles |> justs) ++ projectiles'
+ projectiles'' = (newProjectiles |> (List.filterMap identity)) ++ projectiles'
in (enemies'', projectiles'')
stepEnemyCollisions: [Projectile] -> [Enemy] -> ([Projectile],[Enemy],[Explosion])
stepEnemyCollisions projectiles enemies =
- let hits = projectiles |> concatMap ((flip map enemies) . (,)) |> filter (uncurry (within 14 8))
+ let hits = projectiles |> concatMap ((flip map enemies) << (,)) |> filter (uncurry (within 14 8))
(hitProjectiles, hitEnemies) = unzip hits
explosions = hitEnemies
|> map (\enemy -> {
@@ -133,7 +134,7 @@ stepExplosions t explosions =
in explosions
|> map (stepObj t)
|> map burn
- |> filter ((<) 0 . .time)
+ |> filter ((<) 0 << .time)
stepScore: Int -> Time -> Int -> Int
View
@@ -1,9 +1,12 @@
module PewPew.View where
+import String
+import Text
import PewPew.Model (..)
+
txt fn message =
- (leftAligned . (typeface ["helvetica", "sans-serif"]) . (Text.color (rgb 255 255 255)) . fn) (toText message)
+ (leftAligned << (typeface ["helvetica", "sans-serif"]) << (Text.color (rgb 255 255 255)) << fn) (toText message)
displayProjectile : Projectile -> Form
displayProjectile {x,y} =
@@ -69,7 +72,7 @@ displayGameOver message (w,h) ({score} as game) =
collage gameWidth gameHeight [
filled (rgba 0 0 0 0.5) (rect gameWidth gameHeight),
toForm (txt (Text.height 50) message) |> move (0, 30),
- toForm (txt ((Text.height 20) . (line Under)) "Tweet My Score" |> link (tweetLink score)) |> move (0, -30)
+ toForm (txt ((Text.height 20) << (Text.line Text.Under)) "Tweet My Score" |> link (tweetLink score)) |> move (0, -30)
]
]

0 comments on commit 6e7e997

Please sign in to comment.