Game Development Reference
In-Depth Information
Written in ActionScript, using the Math class methods for
exponents, this same function results in
Math.sqrt(Math.pow((x2-x1),2) + Math.pow((y2-y1),2));
ll see that the pointer will only follow
the cursor when the mouse is within 150 pixels of it. We have
bestowed the pointer with a basic decision-making ability. So far,
these examples have been fairly abstract
Upon testing the SWF, you
t really consti-
tute a game. We will use these examples as part of a larger piece of
game code, but first we need to understand a little more about
they don
s coordinate system.
3D in Flash
A new feature introduced in Flash CS4 is support for
objects. This ability is sometimes misunderstood initially and
requires a little clarification. Flash cannot natively use 3D models
created in programs such as Autodesk Maya or 3D Studio, though
starting in future versions of Flash you will be able to do this
through external libraries and hardware acceleration. Rather, the
current features manipulate 2D objects in 3D space, allowing for
effects such as true perspective skewing and distortion. One way
to think about it is to imagine all your objects on the Stage like
rigid pieces of paper; they have no perceivable depth, but you
can tell their orientation in 3D space. This new ability adds
several new properties to DisplayObjects, not the least of which is
the introduction of a third, or z ,axis. Figure 11.9 illustrates how
the z -axis is represented in the two-dimensional environment of
Figure 11.9 The new z-axis in
Flash is perpendicular to both
the x and y axes.
Search Nedrilad ::

Custom Search