0

At the beginning of the program, the user can give the simulation some "information":

    main:: IO()
        main = do
        putStrLn("Hallo")
        val <- getLine
        startGUI(read val ::Float)

The function (startGUI) :

startGUI :: Float -> IO ()
startGUI si  = simulate window background fps initialState render $ moveBall si

Starts a function, which is some kind of a loop for the simulation. It basically updates the game.

The moveBall function is defined like:

moveBall :: Float -> Float -> PongGame -> PongGame
moveBall seconds go game = game { ballLoc = (x', y') }
...

The error message, which I get is:

Couldn't match type ‘PongGame’ with ‘PongGame -> PongGame’
    Expected type: ViewPort -> Float -> PongGame -> PongGame
      Actual type: Float -> PongGame -> PongGame
    Possible cause: ‘moveBall’ is applied to too many arguments
    In the second argument of ‘($)’, namely ‘moveBall si’
    In the expression:
      simulate window background fps initialState render $ moveBall si

it refers to the startGUI function.

Thanks in advance.

Max K
  • 171
  • 12

1 Answers1

1

The key is to pass start information is to pass them over the initalState function.

startGUI :: Float -> IO ()
startGUI si  = simulate window background fps (initialState si) render  update

Then you just have to configure your dataSet for the game.

Max K
  • 171
  • 12