Game Development Reference
In-Depth Information
Notice the negative sign:
rt9)17
What does it tell you? Remember that in Flash the very left edge of the stage has an t value of ,. As
you move to the right, the t value increases. If you move to the left, it decreases. That means that
those t values that are negative are actually pointing to the left . Positive values point to the right . This
directive thus tells you the speed and direction, also known as velocity:
1letahopkpdahabp*
Here's another example:
ru9'17
ru refers to the velocity of the object on the y (vertical) axis. The very top of the stage has a u value of
,. As you move down the stage, the values increase. This directive says the following:
1letaho`ksj*
That's its velocity! Not so hard at all, is it? Figure 6-7 is a diagram of how positive and negative values
can show direction.
x
y
Figure 6-7. You can find the direction of movement by determining whether the x or y
values are positive or negative.
If all this seems spectacularly underwhelming and blindingly obvious, good for you! It should be!
Now let's see how all this talk of velocity fits in to what's going on in the program.