Need to make a block sliding on a slope

import Graphics.Element exposing (..) import Graphics.Collage exposing (..) import Color exposing (..)

import Signal exposing (map2,foldp) import Time exposing (fps) import Window exposing (dimensions)

{- - main uses signals to reactively render the ball to the screen - It uses a signal "fps" that starts at zero that counts up 30 times - per second and a window dimensions signal is to account for changes - to the screen at runtime -}

main : Signal Element main = Signal.map2 drawSprite (Signal.foldp (+) 0 (Time.fps 30)) Window.dimensions

{- - drawSprite creates a collage using updatePos and updateScale to set - the position and scale of the sprite based on the current incrementer - t and the window dimensions -}

drawSprite : Float -> (Int,Int) -> Element drawSprite t (width,height) = let scale' = updateScale (t/2) (width,height) pos' = updatePos (t/2) (width,height) in collage width height [ sprite scale' pos']

{- - Change updatePos so that the sprite will bounce back and forth - across the screen - HINT: Use mod and integer division (%,//) - Don't forget about strict typing (use toFloat and round for conversions) -}

updatePos : Float -> (Int,Int) -> (Float,Float) updatePos t (width,height) = let startX = -(toFloat width)/80.0 in (startX + 200*sin (t/1000), 0) --t/ whatever slows down the pace (time) --added sin

{- - Change updateScale to add perspection (make the sprite bounce) - HINT: use trig functions (i.e sin, cos) -}

updateScale : Float -> (Int,Int) -> Float updateScale t (width,height) = (2*sin (t/50)) +2 -- added sin t

{- - Change the sprite to draw something other than a red circle -}

sprite : Float -> (Float,Float) -> Form sprite s pos = let sprite' = filled green <| circle 50 in sprite' |> move pos |> scale s

/r/elm Thread Parent