<i id='whQd4'><tr id='whQd4'><dt id='whQd4'><q id='whQd4'><span id='whQd4'><b id='whQd4'><form id='whQd4'><ins id='whQd4'></ins><ul id='whQd4'></ul><sub id='whQd4'></sub></form><legend id='whQd4'></legend><bdo id='whQd4'><pre id='whQd4'><center id='whQd4'></center></pre></bdo></b><th id='whQd4'></th></span></q></dt></tr></i><div id='whQd4'><tfoot id='whQd4'></tfoot><dl id='whQd4'><fieldset id='whQd4'></fieldset></dl></div>
      1. <tfoot id='whQd4'></tfoot>

        <small id='whQd4'></small><noframes id='whQd4'>

        <legend id='whQd4'><style id='whQd4'><dir id='whQd4'><q id='whQd4'></q></dir></style></legend>

          <bdo id='whQd4'></bdo><ul id='whQd4'></ul>

        为什么我的游戏角色在不同的电脑上速度不同?

        时间:2023-08-02
          <tbody id='YTgna'></tbody>

      2. <tfoot id='YTgna'></tfoot>

        <small id='YTgna'></small><noframes id='YTgna'>

        <legend id='YTgna'><style id='YTgna'><dir id='YTgna'><q id='YTgna'></q></dir></style></legend>

          • <bdo id='YTgna'></bdo><ul id='YTgna'></ul>

                  <i id='YTgna'><tr id='YTgna'><dt id='YTgna'><q id='YTgna'><span id='YTgna'><b id='YTgna'><form id='YTgna'><ins id='YTgna'></ins><ul id='YTgna'></ul><sub id='YTgna'></sub></form><legend id='YTgna'></legend><bdo id='YTgna'><pre id='YTgna'><center id='YTgna'></center></pre></bdo></b><th id='YTgna'></th></span></q></dt></tr></i><div id='YTgna'><tfoot id='YTgna'></tfoot><dl id='YTgna'><fieldset id='YTgna'></fieldset></dl></div>
                  本文介绍了为什么我的游戏角色在不同的电脑上速度不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Java Script 开发在线游戏.我正在使用 setInterval (movimage, 10) 方法来移动游戏角色.但是我看到游戏角色的移动速度是不一样的都是电脑.请给我建议.

                  I am developing an online game using Java Script. I am using setInterval (movimage, 10) method to move the game character. But I have seen that the movement speed of the game character is not same is all computer. Please suggest me.

                  推荐答案

                  你可能应该使用 requestAnimationFrame (https://developer.mozilla.org/en-US/docs/DOM/window.requestAnimationFrame).

                  Instead of setInterval you should probably use requestAnimationFrame (https://developer.mozilla.org/en-US/docs/DOM/window.requestAnimationFrame).

                  尝试比屏幕绘制速度更快地更新内容是没有意义的.您的目标是 60fps,即每帧约 16 毫秒.

                  There is no point trying to update something quicker than the screen can draw. You are aiming for 60fps, which is about 16ms per frame.

                  http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 提供了有关如何执行此操作的更多信息.

                  http://paulirish.com/2011/requestanimationframe-for-smart-animating/ has some more info about how to do this.

                  浏览器支持非常好(http://caniuse.com/#feat=requestanimationframe)简而言之,除了 Android Stock 浏览器之外的所有当前浏览器.

                  Browser support is pretty good (http://caniuse.com/#feat=requestanimationframe) in short, all current browsers apart from the Android Stock browser.

                  如果您必须在 IE9 及更低版本中使用此功能,https://gist.github.com/paulirish/1579671 在模拟这些浏览器中的行为方面做得不错.(虽然说实话,我怀疑这将是你最后的担忧,特别是关于缺少 canvas...)

                  If you must have this working in IE9 and lower, https://gist.github.com/paulirish/1579671 does a decent job of simulating the behaviour in those browsers. (though to be honest, I suspect this will be the last of your worries, particularly in regard to the lack of canvas…)

                  这篇关于为什么我的游戏角色在不同的电脑上速度不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:仅转换 Path2D 的样式 下一篇:如何保护 HTML5/Canvas 游戏中的代码?

                  相关文章

                  <i id='ZsAgj'><tr id='ZsAgj'><dt id='ZsAgj'><q id='ZsAgj'><span id='ZsAgj'><b id='ZsAgj'><form id='ZsAgj'><ins id='ZsAgj'></ins><ul id='ZsAgj'></ul><sub id='ZsAgj'></sub></form><legend id='ZsAgj'></legend><bdo id='ZsAgj'><pre id='ZsAgj'><center id='ZsAgj'></center></pre></bdo></b><th id='ZsAgj'></th></span></q></dt></tr></i><div id='ZsAgj'><tfoot id='ZsAgj'></tfoot><dl id='ZsAgj'><fieldset id='ZsAgj'></fieldset></dl></div>

                • <legend id='ZsAgj'><style id='ZsAgj'><dir id='ZsAgj'><q id='ZsAgj'></q></dir></style></legend>

                  <tfoot id='ZsAgj'></tfoot>
                  • <bdo id='ZsAgj'></bdo><ul id='ZsAgj'></ul>

                  <small id='ZsAgj'></small><noframes id='ZsAgj'>