justgook/elm-game-logic/1.0.0

NOTE: the latest version is 3.0.0

Logic.GameFlow

= Running
| Pause
| SlowMotion
{ frames : Int
, fps : Int
}

game flow for update function

  1. Running - runs in normal way 60FPS

  2. Pause - game is stopped, and no Systems is running

  3. SlowMotion { frames = 60, fps = 20 } - will run game 20FPS for next 60 frames (3s)

update : (Model a -> Model a) -> Float -> Model a -> Model a
type alias Model a =
{ a | frame : Int, runtime_ : Float, flow : GameFlow }

Extendable Model to run inside update

(ExtendedModel a b -> ExtendedModel a b)
-> Float
-> ExtendedModel a b
-> ExtendedModel a b

same as update, but instead of Model, takes tuple, to make same output as default Elm update function

type alias ExtendedModel a b =
( Model a, b )