游戏中的帧时序
我决定在我的节奏游戏中从基于毫秒的计时转换为帧计时。我知道我可以检查动画的当前帧来获取按下按钮的时间,但是当动画结束并且我想要最后有大约 100 毫秒的“延迟缓冲区”时该怎么办?我可以依靠计时器吗?
Ive decided to convert from doing millisecond based timing to frame timing in my rhythm game. I understand I can check the current frame of the animation to get timing for a button press, but what about when the animation ends and I want a "late buffer" of about 100 milliseconds at the end? Can I rely on a timer for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将其限制为易于实现的帧速率,您将能够做到。这样您就会知道每秒运行多少帧,从而知道需要等待多少帧。
或者,您可以将两者混合起来并记录动画最后一帧运行的时间,并且在记录的时间加上 100 毫秒过去之前不允许它重播。
我认为现在大多数人在游戏中使用基于时间的计时,因此如果不需要编写帧,他们可以做一些其他处理
You will be able to if you limit it to a easily achieviable frame rate. That way you'll know how many frames per second you're running on and thusly how many frames you need to wait.
Or you could do a mixture of both and record the time the last frame of your animation ran, and dont allow it to replay untill the recorded time plus 100 milliseconds has passed.
I think most people use time based timing in games now adays so they can do some other processing if the frame doesnt need to be written