一个Haskell的游戏框架:ActionKid

jopen 10年前

一个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
一个Haskell的游戏框架:ActionKid

项目主页:http://www.open-open.com/lib/view/home/1414051149622