【发布时间】:2013-04-02 13:03:46
【问题描述】:
我认为我需要一些激励来了解如何制作这个,我在一般平台游戏机制方面并没有真正的经验......
反正我的玩家图到现在都有这个:
movePlayer = proc p -> do
let gravity = 100
sx <- keySpeed GLFW.LEFT GLFW.RIGHT 500 -< ()
dy <- integralLim_ collision 0 -< (gravity, p)
dx <- integralLim_ collision 0 -< (sx, p)
returnA -< (sx, sy)
where
keySpeed k1 k2 s = onKey k1 (-s) <|> onKey k2 s <|> pure 0
collision = undefined -- collision with the world
使用gravity,玩家对象会慢慢下落,直到有东西可以站立。当然,下一步是添加跳跃,在sin 曲线中......使用netwire 添加它的简单方法是什么?还可以添加进一步的碰撞检测吗?
我只是不知道从哪里开始。
【问题讨论】:
标签: haskell reactive-programming frp arrows netwire