Skip to content

Instantly share code, notes, and snippets.

@tibastral
Created August 20, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibastral/0594315d709c775ef4a2398c54db5835 to your computer and use it in GitHub Desktop.
Save tibastral/0594315d709c775ef4a2398c54db5835 to your computer and use it in GitHub Desktop.
step : Game -> Position -> Game
step game arrows =
game
|> handleWinning
|> handleLoosing
|> stepCharacter arrows
|> stepEnemies
isWinning : Game -> Bool
isWinning { character, goal } =
character |> Character.collision goal
handleWinning : Game -> Game
handleWinning game =
game
|> ifonly isWinning (game |> win)
isLoosing : Game -> Bool
isLoosing { character, enemies } =
enemies |> any (Character.collision character)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment