直接管理影片剪辑绘制。 AS3

发布于 2024-10-06 21:51:49 字数 263 浏览 6 评论 0原文

所以,我想知道是否可以停止所有动画,进行诸如“移动一堆敌人影片剪辑、移动一些子弹等”之类的计算,然后再次启动动画,以便所有绘图同时发生。

我的应用程序将位于我的游戏的游戏循环中。我遇到的问题是,屏幕上有大约 50 个敌人,所有这些敌人都移动得非常快,我穿过阵列并移动每个影片剪辑。有一些滞后,我想尽我所能消除它。

如果我正确理解 AS3,它会在每次更改每个 MovieClip 的 X 和 Y 值后尝试绘制到屏幕上。通过停止动画,设置这些值,然后再次启动它,我想我会大大提高性能。

So, I'm wondering if it's possible to stop all animation, do computations such as "moving a bunch of enemies movieclips, moving some bullets, etc.", then starting the animation again so that all of the drawing would occur at once.

My application would be in the game loop of my game. The problem I'm having is that I have around 50 enemies on screen, all of which are moving very fast, and I walk through the array and move each MovieClip. There's some lag and I'd like to get rid of it in any way I can.

If I understand AS3 correctly, it would try to draw to the screen after each change of the X and Y value of each MovieClip. By stopping animation, setting these values, then starting it up again, I think I'd increase performance by quite a bit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒儿 2024-10-13 21:51:49

如果性能是您的目标,您可能需要考虑放弃 MovieClips(非常昂贵)以进行位块传输。本质上,您正在计算运动、碰撞等,然后将一次绘制到位图画布中,而不是绘制每个影片剪辑。

用位图替换任何矢量艺术也将显着加快渲染速度。尝试使用尽可能少的框架。查看 8bitrocket 了解有关 Blitting 的更多信息。

If performance is your goal, you may want to think about dropping MovieClips (which are quite expensive) for bit-blitting. Essentially you're calculating movement, collision, et al and then doing one draw into a bitmap canvas instead of drawing each MovieClip.

Replacing any vector art with Bitmaps will significantly speed up your render as well. Try to use as few frames as possible. Check out 8bitrocket for more on Blitting.

夏天碎花小短裙 2024-10-13 21:51:49

Flash 渲染每一帧一次。您可以在“帧之间”随心所欲地移动内容。所以,现在移动敌人的方式才是正确的方式。

使用位块传送是一种核心选项,您可以获得很多性能,但也会失去闪存提供的许多好处,例如旋转/缩放和鼠标/交互位。

在没有看到游戏的情况下很难给出任何其他指示,但一般来说,尽量避免大面积的透明度,遮罩可能会很昂贵,并且滤镜渲染起来可能很繁重。

Flash renders each frame once. You can move stuff around all you want "between" frames. So, the way you are moving your enemies now is the proper way.

Using blitting is sort of the nuclear option, you gain a lot performance wise but you'll also loose many of the benefits flash gives such as rotation/scaling and the mouse/interactivity bit.

It's hard to give any other pointers without seeing the game, but generally, try to avoid transparency over large areas, masking can be expensive and filters can be heavy to render.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文