Optimizing transition/movement smoothness for a 2D flash game

后端 未结 8 1125
星月不相逢
星月不相逢 2020-12-10 22:42

Update 6:

Fenomenas suggested me to re-create everything as simple as possible. I had my doubts that this would make any difference as the algorithm

8条回答
  •  眼角桃花
    2020-12-10 23:17

    Your code runs smooth to me. No spikes whatsoever. Tested it with the following code added at the end of the updatePoller function.

    var shadow:Sprite = new Sprite();
    shadow.graphics.beginFill(0xFFFFFF, 0.01);
    shadow.graphics.lineStyle(1, 0xFFFFFF, 0.8);
    shadow.graphics.drawRect(0, 0, 25, 50);
    this.addChildAt(shadow, 0);
    shadow.x = shipContainer.x;
    shadow.y = shipContainer.y;
    shadow.rotation = shipContainer.rotation;
    

    The 100 fps version tends to get non-uniform patterns, but it's normal because based on your calculation, it can't be possible to render 100 frames in a second, if calculating a frame takes more than 10 ms. So, for me at least, the last code runs smoothly, on 30fps.

    As for the fuzzy part, a major dooh, and hopefully you won't get mad with me asking: Is there any chance that the fuzzy / blurry effect is because your Monitor? Even at 10 ms response time on an LCD Monitor, a white rapidly moving something imposed on a static black background, tends to look blurry.

提交回复
热议问题