Game Development Reference
In-Depth Information
Chapter 8
In this topic, I've described AS3.0 as an object-oriented programming language ,
which means that objects are at the very center of the programming universe. If that
still sounds hopelessly vague, don't worry; by the end of this chapter, you'll know
exactly what this means and the power it can give you as a game designer.
Up until this point in the topic, all the programming has been done inside one class:
I]ej. You set the FLA's document class in the ?h]oo field of the movie's Properties
panel. This means that the I]ej class runs automatically when the SWF file runs. This
style of programming is known as procedural programming . Procedural programs
are composed using methods to build the program modularly. Each method does
a specific job or solves a specific problem, and the program is built by all these
methods working together. The number guessing game from Chapter 5 is a classic
example of a procedural program.
Procedural programming is quick, convenient, and a great way to write programs and
small games. In many cases, a procedural solution is a better solution to a program-
ming problem than an object-oriented solution. The only problem is that sooner or
later the complexity of your games will increase, so trying to cram them all into one
class file, or even a few related ActionScript files, becomes really impractical. That's
the point at which taking a look at the object-oriented way of doing things will make
a lot of sense.
Search Nedrilad ::

Custom Search