Game Development Reference
In-Depth Information
The program might seem modest, but you will achieve two very important things by learning to write it:
1. You'll build a robust and flexible system for programming that will become the core of all the
projects in this topic and probably hold you in good stead with your own projects for years to
2. You'll complete a crash course in programming with AS3.0 that will lay the foundations for
some of the very important concepts and techniques covered in later chapters.
Scared of programming? Ha! Not you! In this chapter, you'll grab the programming beast by the horns
and wrestle it to the ground!
Files you'll need
When you create a game with Flash and AS3.0, you don't work with only one file; you'll need at least
the following two files:
AS file : This file contains all your AS3.0 programming code—the brains of your game. AS files
are simply text files with an *]o file extension (you'll learn more details in a moment). If you
have used earlier versions of Flash and are migrating to AS3.0 from AS2.0 or AS1.0, you might
have done most or all of your coding directly in frames on the timeline and used only one file:
an FLA file. You can actually still use timeline code, but now is the time to bite the bullet and
say goodbye to it for good. Don't worry; you'll soon see that keeping all your programming
code in a separate AS file is actually much more efficient and in fact much easier than keeping
track of what invariably turned into an unmanageable sprawling mess of timeline code in ear-
lier versions of Flash.
FLA file : This is an ordinary Flash file and has an *bh] file extension. This file is where all the
visual objects for your programs will reside, such as game characters and environments. The AS
file is actually the one that does all the “thinking,” but it depends on the FLA file to do all the
administrative work of interpreting and running the programming code (turning it into a play-
able game), displaying it on the screen, and allowing players to interact with it. The FLA file can
also contain embedded assets (such as animations, sounds, videos, and graphic artwork) that
your game might need.
After you finish designing your game, the FLA and AS files will work together to produce a third file
known as a Flash movie file . The Flash movie file is your finished product; it's the file that you can
upload to the Internet to share with the rest of the world. Flash movie files have the file extension
*osb, so I'll call them SWF files throughout the remainder of the topic. To create a SWF file, you need
to publish it from Flash. You'll see how to do that in a moment.
Setting up the work environment
Before you start writing your Hello World program, you need to organize the work directory and cre-
ate blank FLA and AS files that you need to start programming with. You'll use this same format for all
the projects in the rest of the topic.
1. Find a convenient spot on your hard drive and create a project folder called DahhkSknh`
Search Nedrilad ::

Custom Search