是关闭阶段的DisplayObject在Flash仍趋缓我的游戏?我的、阶段、游戏、Flash

2023-09-08 14:06:16 作者:没死就别把自己当废物

如何闪存处理是台下的元素?

How does Flash deal with elements that are off-stage?

显然闪光灯实际上不使它们(因为它们没有出现在屏幕上的任何地方),但使它们依然存在,减缓我的游戏一样,因为它会如果元素是屏幕上的过程?

Obviously Flash doesn't actually render them (because they don't appear anywhere on-screen), but is the process of rendering them still existent, slowing down my game as much as it would if the elements were on-screen?

抑或闪存智能忽略谁不陷入呈现区域要素?

Or does Flash intelligently ignore elements who don't fall into a renderable area?

我应该手动管理删除掉图像显示对象,并将其添加回作为退出和进入的阶段,或者这将是无关紧要的?

Should I manually manage removing objects off the DisplayList and adding them back on as the exit and enter the stage, or is this going to be irrelevant?

推荐答案

是的,他们正在减慢你的游戏。

Yes, they are slowing down your game.

在我早期的一个实验中,我与许多的NPC分散地图,在同一屏幕不是所有可见周围的sidescroller游戏。我仍然有计算的东西,但他们并没有在屏幕上。表现得显著更好,当我处理它们除去不在显示列表无关时,(通过简单地检查其相对于X到照相机)。同样,我不是在谈论另外code和可连接到他们的事件,只是简单的图形化的一个影片剪辑的孩子。

In one of my early experiments I've developed a sidescroller game with many NPCs scattered around the map, not all visible in the same screen. I still had to calculate stuff but they weren't on the screen. The performance was significantly better when I handled their removal off the display list when irrelevant (by simply checking their X in relation to the 'camera'). Again, I'm not talking about additional code and events that may be attached to them, just plain graphical children of a movieclip.

最好的做法,虽然在我的经验,正在制定中的对象的位图。当然,如果你太深入到你的游戏已经这可能是无关紧要的,但如果你有投资的时候,这是要充分利用有关2D游戏AS3的最佳途径之一。我发现有关的位图和AS3中8bitrocket一些最伟大的教程 http://www.8bitrocket.com/books/the-必要引导到闪存游戏/ 我关于这个问题的详细说明,如果你想要的,但我想我会题外话这里。

The best practice though, in my experience, is drawing the objects in bitmaps. Of course if you're too deep into your game already this may be irrelevant, but if you have the time to invest, this is one of the best ways to get the most out of AS3 regarding 2D games. I found some of the greatest tutorials regarding bitmaps and AS3 in 8bitrocket http://www.8bitrocket.com/books/the-essential-guide-to-flash-games/ I can elaborate on the subject if you want, but I think I'm going off topic here.