Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell ReacTime函数崩溃游戏_Haskell_Gloss - Fatal编程技术网

Haskell ReacTime函数崩溃游戏

Haskell ReacTime函数崩溃游戏,haskell,gloss,Haskell,Gloss,我的问题是,我做了一个游戏,我有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,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
所以我已经很好地定义了高级功能(当然)做了第二次传球时应该发生的事情,但我真的不知道如何做反应时间功能,有人能帮忙吗

-- | Function that alters the game state when time advances
reactTime :: Float -> State -> State
reactTime f s =  advance s (exponent f)
重要注意事项: 我的时间应该从x开始(值我还没有决定),到0结束

所以我需要使f的值减小1秒,这个时间函数是怎样的,有人知道吗

如果我使这个函数等于

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

游戏运行得很完美,但如果没有时间,就不可能玩。

只有当fr等于1时,游戏才会运行。不知道为什么,但它解决了问题。只要我们不能复制这种行为,我们就不能帮助你。确保包含足够的(示例)代码来重现问题。最佳情况?实际上,你自己也发现了问题,为什么你要简化你的程序。