Game Development Reference
In-Depth Information
and you needed a filter applied that would persist until the object
was removed (such as, say, a drop shadow), you could call the
applyFilter method on the BitmapData to render the filter effect
into the image itself (and thus eliminating the repeat cost of ren-
dering the effect over and over again). This could potentially save
file size on the images used and would provide some level of run-
time flexibility to be able to change the values of the filter prior to
s important to emphasize that this is a
costly process on iOS, so if this was a feature you planned to
implement, you would want to perform these operations at the
onset of a level or gameplay session to avoid noticeable stuttering
in your game.
On a related note, filters created with PixelBender (or ShaderFil-
ters) are not supported in iOS-exported Flash applications. This has
to do with the way that the Shaders are applied, but even if they were
supported, they would come with even stronger performance caveats
and warnings. This is important to consider if you
re attempting to
port an existing Flash game to iOS; if your game mechanic relies
heavily on Shaders, you
ll need to either find a way to recreate the
effect another way or change the functionality completely.
Vector Shapes (and Shape Tweens)
The ability to create file-size efficient and clean vector graphics has
been a hallmark of Flash since the very beginning. Like filters, they
are another core feature of the Flash Player that designers and
developers make use of frequently. Unfortunately, like filters, they
come with fairly substantial overhead cost when the renderer has
to redraw the screen, particularly when dealing with complex
shapes. This cost is further multiplied when performing shape
tweens (known as MorphShapes in ActionScript), so these should
be avoided altogether.
In general, it
s a good idea to stick with bitmaps as much as
possible when creating games for iOS devices. They are the fastest
type of display object for the rendered to process, and with proper
compression the artwork for a game should not get out of hand
very quickly in terms of file size. Thanks to the new CS5.5 Export
as Bitmap option we looked at in Chapter 6, you can now set some
of your vector instances to rasterize on compile. That said, there
are times when it is okay to use vector graphics without incurring
too great a resource load. When determining whether to use vector
art for an element in your game, consider the following questions:
Will the art remain static?
Can I group multiple vector elements together inside a single
Search Nedrilad ::

Custom Search