Game Development Reference
In-Depth Information
Solution: Write Your Own/Find Open Source
Implementations
Unfortunately, until Adobe adds game-specific libraries to the Flash
player, we are stuck building our own. Luckily, many developers in
the Flash community are working to either port libraries such as
these from other languages or write them from the ground up in
ActionScript. Many of them are open-source projects that anyone
can contribute to and improve. There are links to a number of
these on this topic
ll even explore one in
Chapter16fordoing2Dphysics.TobefairtoAdobe,therearea
number of new capabilities coming in future versions of the Flash
player that support such game-centric features as 3D hardware
acceleration and control pads.
'
sWebsite,andwe
'
Stop Fighting It
Traditional game developers sometimes try to fight Flash
snat-
ure when they first make the transition, but often the best way
togetthedesiredresultoutofFlashistoplaytoitsstrengths.
Take, for example, a character in a game you want to animate
depending on its state (idle, running, jumping, etc.). An artist
has given you image sequences of each of these states. The char-
acter
'
s state may be controlled by user input with the mouse or
keyboard, or by AI. A conventional approach to this problem
wouldbetowriteascriptthatupdatesthecharacterwiththe
correct frame of animation based on what the game is telling it
to do. However, this requires the script to know how many ani-
mations there are, how many frames each animation is, and
whether the animations loop or only play once. It also has to
add the new image to the Stage and remove the old one. In
addition, it adds overhead to any other code running in the
game, which can become troublesome if you have many charac-
ters on screen at once.
This is a perfect example of an area where Flash shines over
other game development tools. Because the environment is built
around the concept of timelines and animation, you have a tre-
mendous amount of flexibility when it comes to controlling player
states, game states, or any other objects in your game that are
more than a still image. The trick is in knowing what Flash does
best and where you need to alter its behavior.
The flip side of the game development coin is that games do
take code: often lots of it. A game built entirely around animation
and fancy art would not likely be very interesting or reusable at a
later date. Users who have previously built content in Flash with
very little scripting may find themselves panicking at the sight of
'
Search Nedrilad ::




Custom Search