Game Development Reference

In-Depth Information

So how does this actually work to accelerate the object? Let's trace the output and find out:

1.
Add the following pn]_a directive to the Lh]uan[=__ahan]pa class in the kjAjpanBn]ia event

handler:

++Ikrapdalh]uan

t'9[rt7

u'9[ru7

pn]_a$[rt6'[rt%7

pn]_a$t6't%7

pn]_a$))))))))))%7

2.
Save the Lh]uan[=__ahan]pa*]o file.

3.
Test the project.

4.
Press the right arrow key and check the trace in the
Output
window. When the object starts

moving, you'll see something that looks like this:

[rt6,

t6.31

))))))))))

[rt6,*.

t6.31*.

))))))))))

[rt6,*0

t6.31*11

))))))))))

[rt6,*2,,,,,,,,,,,,,,-

t6.32*-1

))))))))))

[rt6,*4

t6.32*51

These are the first 5 frames of movement, but this pattern continues until [rt reaches a maximum

value of 1, which is what the [olaa`Heiep property is set to.

The numbers with the large number of decimal places are a byproduct of the way the CPU's binary

number system stores fractions. For all practical purposes, you can ignore the strings of zeros and

round off to two decimal places.

The smallest unit into which Flash can divide a pixel is 0.05. This unit is known by the

whimsical name
twip
(20 twips equal 1 pixel). That's why all the t and u values you see

in the pn]_a output are multiples of 0.05.