0

My problem is that i made a game, i have initialState, drawState and reactEvent running well, but my reactTime function when i activate it crash's the programm

-- | Main function that invoques the game
main :: IO ()
main = do 
      play dm           -- display mode
        (greyN 0.5)     
        fr              -- frame rate
        initialState    -- initial game state
        drawState       -- draws game state
        reactEvent      -- reacts to event
        reactTime       -- reacts to time

So i have the advance funtion definined well(for sure) doing what is suppose to happen when a second pass but I don't really know how to do the reactTime function, can someone help?

-- | Function that alters the game state when time advances
reactTime :: Float -> State -> State
reactTime f s =  advance s (exponent f)

Importante notes: My time is suppose to start at x(value I have to decide yet) and end at 0

So I need to make that f decrease the value 1 for second, how is this reactTime function suppose to be anyone has any idea?

If I make this function equal to

-- | Function that alters the game state when time advances
reactTime :: Float -> State -> State
reactTime f s = s

the game runs perfectly, but without time passing its impossible to play.

Dost
  • 33
  • 7
  • The game only works if I have fr equal to 1. Dont know why, but it solves the problem. – Dost Dec 30 '16 at 04:32
  • As long as we cannot reproduce the behaviour, we cannot help you. Make sure that you include enough (example) code to reproduce your problem. Best case scenario? You actually find the problem yourself why you try to simplify your program. – Zeta Dec 30 '16 at 08:44

0 Answers0