Skip to content

Instantly share code, notes, and snippets.

@scan
Created April 11, 2013 05:58
Show Gist options
  • Save scan/5361070 to your computer and use it in GitHub Desktop.
Save scan/5361070 to your computer and use it in GitHub Desktop.
let player = proc j -> do
sx <- keySpeed GLFW.LEFT GLFW.RIGHT 500 -< ()
let gravity = (0, 9.8)
jump <- pure (0, (-100)) . holdFor 0.1 (keyPressed ' ') <|> pure (0, 0) -< sx
v <- integral_ (0,0) -< gravity ^+^ jump
(dx, dy) <- integralLim_ collision (0,0) -< (v ^+^ (sx, 0), ())
returnA -< renderSprites [Sprite img (realToFrac dx, realToFrac dy) 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment