我真的不确定这是否是我问题的解决方案,但这是我唯一能想到的。 我正在LibGDX中设计一个简单的平台引擎,但每当你拖动游戏窗口(或在窗口窗格上按住鼠标左键)一段时间后,当你放手时,角色会掉落在地板上,因为加速度的增加(你放手的时间越长,他放手后传送的距离越远)。 由于某种原因,拖动窗户的行为可以防止地面停止加速度的增加。 我能想到的唯一解决方案是在窗口失焦时暂停游戏,但这可能完全错误。
谢谢。
I'm really not sure if this is the solution to my problem, but it's the only thing I can think of. I'm designing a simple platforming engine in LibGDX, but whenever you drag the game window (or hold the left mouse button over the window pane) for a certain period of time, when you let go the character will fall through the floor due to a build up of acceleration (the longer you hold it the further he'll teleport down after letting go). For some reason the act of dragging the window prevents the ground from stopping the acceleration buildup. The only solution I can think of is to pause the game when the window is out of focus, but that might be completely wrong.
Thanks.
最满意答案
我通过仅在deltaTime足够小时更新位置来解决它,因为deltaTime在拖动窗口时增加。
I solved it by only updating the position if deltaTime is small enough, since deltaTime increases while the window is being dragged.
更多推荐
发布评论