Game Development Reference
In-Depth Information
One drawback of the Ikrea?hel class is that its inclusion of a timeline adds slightly more size to the
file and consumes a little more of the Flash Player's memory when the program runs. It's not much
more (about 30 bytes), but the general rule of thumb is that if you're creating graphic objects that
don't use a timeline, you should instead import and extend the Olnepa class. The Olnepa class is the
same as the Ikrea?hel class, but it doesn't include a timeline. If you use the Olnepa class wherever
you can, you will probably find your larger-scale programs and games run more quickly and smoothly
because they won't be consuming as much memory or processing power.
As your programs and games become bigger and more complex, they'll start to run
sluggishly or become less responsive as you add more and more code. The respon-
siveness of software is something programmers call performance . In game design, in
which lightning-quick response time and feedback from a game is essential for making
the game fun to play, performance is the keystone around which your game will be
built. Imagine playing Missile Command , hitting the fire button, and then having to
wait for a second or two before your rocket launches. Wouldn't be much fun to play,
would it? It doesn't matter how good or bad your sounds or graphics are; if your game
lags and limps along like a tired racehorse en route to the glue factory, I guarantee
that its performance is the only thing the players will notice and they'll be demanding
their money back en masse. Performance is the vengeful deity to which game design-
ers bow down and sacrifice their virgins, and you will certainly find yourself making
many difficult decisions about what to sacrifice in your own games in the interest of
performance. By using the Olnepa class instead of the Ikrea?hel class wherever you
can, you'll save a slight bit of processing power that can add up to a lot of improved
performance over the long run (and maybe spare the lives of a few horses and virgins
along the way).
6. Importing a class to use in your program is conceptually identical to importing images or
sounds into the Flash Library (which you might have done if you've worked with Flash before).
The only difference is that you use a directive directly in your program instead of selecting
an option from the Flash menu. Also, the imported class must be imported into the package
before your class definition. To import the Ikrea?hel class into your program, add the follow-
ing bold text (I also added a blank line between the import directive and class definition so the
program is a little easier to read):
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
lq^he__h]ooI]ej
w
lq^he_bqj_pekjI]ej$%
w
pn]_a$ÎDahhkSknh`Ï%7
y
y
y
 
Search Nedrilad ::




Custom Search