Game Development Reference
In-Depth Information
Figure 4.2 The properties
panel shows the linkage for
the square Sprite.
However, suppose that we wanted to create multiple squares of
different colors. They wouldn
t need any additional functionality on
top of what Square already provides, so making an individual class
foreachonewouldbetedious.Instead,wecouldmakemultiple
clips of different colors and set each of their base classes to Square.
Then, the individual class names could be things like squareBlue,
squareGreen, etc. An example is shown in Fig. 4.3 .
'
Using Exported Symbols with No Class File
I try to make it a policy to explicitly write a class file for any
symbol that I intend to export for ActionScript because it is easier
to keep track of which symbols are available to me and allows
me to quickly add functionality as it becomes necessary. How-
ever, sometimes as in the case of the previous Square example,
some of the symbols I
ve
created and are only differentiated by the assets inside them. To
use these classes in your code, youcansimplyrefertotheclass
'
m using all derive from a basic class I
'
Search Nedrilad ::




Custom Search