Game Development Reference
In-Depth Information
Easing to random positions and calculating velocity
Let's look at another practical example. In the chapter source files, open the N]j`kiPsaaj folder as
a project and test it. The nk^kp object eases to random positions on the stage. In addition, a dynamic
text field displays the robot's rt and ru velocities. Figure 10-11 illustrates what you'll see.
Figure 10-11. The robot eases to a random position on the stage, and a
dynamic text field displays its velocity.
Here's the code that makes it work. Except for the robot's velocity calculation, there's nothing really
new here. Read through the comments in the code, and see if you can match the way it's working with
what you see on the stage when the SWF runs:
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
eilknpbh]od*arajpo*Arajp7
eilknpbh*pn]joepekjo*Psaaj7
eilknpbh*pn]joepekjo*PsaajArajp7
eilknpbh*pn]joepekjo*a]oejc*&7
lq^he__h]ooI]ej[N]j`kiPsaajatpaj`oIkrea?hel
w
++@a_h]nar]ne]^hao
lner]par]n[psaajT6Psaaj7
lner]par]n[psaajU6Psaaj7
lner]par]n[n]j`kiT6qejp7
lner]par]n[n]j`kiU6qejp7
 
Search Nedrilad ::




Custom Search