0

我的问题是我做了一个游戏,我的 initialState、drawState 和 reactEvent 运行良好,但是当我激活它时我的 reactTime 函数崩溃是程序

-- | 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

所以我已经很好地定义了高级功能(肯定)做第二次通过时应该发生的事情,但我真的不知道如何做 reactTime 功能,有人可以帮忙吗?

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

重要说明:我的时间假设从 x(我必须决定的值)开始,到 0 结束

所以我需要让 f 秒减少值 1,这个 reactTime 函数是如何假设任何人有任何想法的?

如果我使这个函数等于

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

游戏运行完美,但没有时间通过​​它是不可能玩的。

4

0 回答 0