Game Development Reference
In-Depth Information
together
code brainstorms.
In experimentation, all you
'
re inter-
ested about is the
behind a mechanism.
However, the moment you start answering to anyone else about
your code, be it a client or a coworker, it is vital to take the time to
do it right. No one is perfect, and no one
idea
'
s code is perfect either,
but there
s a huge visible difference between someone who made a
genuine effort and someone who did not. Even if you
'
'
re indepen-
dent now, don
you
might want to get a job someday and many employers like to see
code samples. Now that we
'
t turn a blind eye to your coding practices
'
velookedatthebareminimum,let
'
s
look at higher ideals toward which we should strive.
Transitioning to Architecture
Ever since ActionScript 3 was introduced, there has been a flurry of
interest regarding architecture and design patterns. If you read
Chapter 1, you will know that design patterns are basically a blue-
print or template for solving development problems. They are
meant to provide re-usable architecture when building applications.
In some areas of the programming community, design patterns are
an essential part of application development. That said, more often
than not, design patterns implemented in ActionScript tend to
hamper development because they work against the natural grain
of the language. One reason for this is that AS3 is already some-
what designed as a language to work in a certain way, specifically
with events.Inthischapter,we
ll explore some of the basic funda-
mentals of object-oriented programming to keep in mind as we
develop, some programming styles and design patterns that work,
and when you should ignore the hype.
'
OOP Concepts
As I mentioned in Chapter 1, object-oriented programming (OOP)
is a model of software design centered around the concept of
objects interacting with each other. To put it into game terms,
every character on the screen in a game would be a unique object,
as well as interactive elements around them. They would all have
commands they accept and messages they can broadcast to each
other. By having each object responsible for its own behavior, pro-
gramming becomes much more modular and flexible. Abstractly,
this is probably not too a difficult concept to grasp. In practice, it
can be difficult to achieve without a certain amount of planning
and forethought. This is where design patterns arose; by using an
style of software design, planning an application
became easier because the template was already designed. Note,
Isaidapplication. Many of the accepted design patterns in the
approved
Search Nedrilad ::




Custom Search