ReacTime function crashing game

40 views Asked by At

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.

0

There are 0 answers