The web site for Flash ActionScript 3.0 game developers

 
         
   

Using Bitmap Drawing as a Substitute For Lots of MovieClips.

Ant wrote:

Just wondering if you know of any useful ways to reduce the slowdown effect caused by having lots of MovieClips in a game. For example I have a student making a shooting game that gets progressively laggier due to all the blood he makes them spawn. At the moment he's using the "cacheAsBitmap" setting which helped a little but I just wondered if there's a way to combine drawings/graphics similarly to how Break Apart works in the normal Flash environment.

Your student must be using a lot of movieclips. I've used hundreds, even thousands, of them without seeing a slowdown in AS3. One key is to keep the complexity of these symbols simple. If they are a drop of blood, for instance, select the shape in the symbol and use the Modify, Shape, Optimize function to reduce its complexity. See how simply you can get the shape while still looking good. Also avoid using gradients if you don't have to. Even using cacheAsBitmap isn't as good as actually using a bitmap, so you may want to consider using a bitmap.
On the other hand, instead of using multiple symbols at all, why not have a single bitmap graphic layer that you draw to? Then add the blood to this single layer by using the BitmapData.draw command.



Copyright Gary Rosenzweig