且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-02 19:39:07

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

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.