Making a game and looking for a way to start the music (made in haskell with Euterpea) when calling the main function to start the game.
The problem with this code is that it will play the music but then it won't start the game. If I put the music after Pure.Game.play the game starts but no music will be played.
main :: IO ()
main = do
backgroundImage <- background
let backgrounds = [backgroundImage]
**Euterpea.play $ Euterpea.line [af 4 dqn :=: cf 4 dqn :=: ef 4 dqn]**
Graphics.Gloss.Interface.Pure.Game.play (InWindow "game" (windowwidth,
windowheight) (0,0)) cyan 300 (drawGame background) inputHandler step
Also tried to have the music in its own function melody :: Music Pitch melody = Euterpea.line [af 4 dqn :=: cf 4 dqn]
and bind it (like with the background): music <- melody and call it in main, but can't get that to work either.
Any tip how to do this?