一個Haskell的游戲框架:ActionKid
一個Haskell的游戲框架:ActionKid。
視頻教程: http://vimeo.com/109663514
該目標是有一個易于使用的游戲框架在Haskell中。例如,下面是你如何讓玩家在屏幕上:
-- create a new player data type data Player = Player { _pa :: Attributes } deriveMC ''Player -- describe what it should look like: instance Renderable Player where render p = image "images/player.png"
這里是你如何移動你的玩家:
handle (EventKey (SpecialKey KeyLeft) Down _ _) = player.x -= 10 handle (EventKey (SpecialKey KeyRight) Down _ _) = player.x += 10 handle (EventKey (SpecialKey KeyUp) Down _ _) = player.y += 10 handle (EventKey (SpecialKey KeyDown) Down _ _) = player.y -= 10

本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!