Installed

elm/browser
1.0.2
elm/core
1.0.5
elm/html
1.0.0
evancz/elm-playground
1.0.3

Registry

elm/http
2.0.0
elm/random
1.0.0
elm/time
1.0.0
elm/file
1.0.5
elm/json
1.1.3
elm/svg
1.0.1
elm-explorations/webgl
1.1.3
w0rm/elm-physics
5.1.3
rtfeldman/elm-css
18.0.0
mdgriffith/elm-ui
1.1.8
​x
  , dir = if vx == 0 then mario.dir else if vx < 0 then "left" else "right"
 
1
-- Walk around with the arrow keys. Press the UP arrow to jump!
2
--
3
-- Learn more about the playground here:
4
--   https://package.elm-lang.org/packages/evancz/elm-playground/latest/
5
--
6
​
7
​
8
import Playground exposing (..)
9
​
10
​
11
​
12
-- MAIN
13
​
14
​
15
main =
16
  game view update
17
    { x = 0
18
    , y = 0
19
    , vx = 0
20
    , vy = 0
21
    , dir = "right"
22
    }
23
​
24
​
25
-- VIEW
26
​
27
​
28
view computer mario =
29
  let
30
    w = computer.screen.width
31
    h = computer.screen.height
32
    b = computer.screen.bottom
33
  in
34
  [ rectangle (rgb 174 238 238) w h
35
  , rectangle (rgb 74 163 41) w 100
36
      |> moveY b
37
  , image 70 70 (toGif mario)
38
      |> move mario.x (b + 76 + mario.y)
39
  ]
40
​
41
​
42
toGif mario =
43
  if mario.y > 0 then
44
    "https://elm-lang.org/images/mario/jump/" ++ mario.dir ++ ".gif"
45
  else if mario.vx /= 0 then
46
    "https://elm-lang.org/images/mario/walk/" ++ mario.dir ++ ".gif"
47
  else
48
    "https://elm-lang.org/images/mario/stand/" ++ mario.dir ++ ".gif"
49
​