[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

Velocities and accelerations can be either positive or negative. The
system treats the velocity, acceleration and Ring values as fixed-point
binary fractions, with the decimal point at position 6 in the word.  That
is: vvvvvvvvvv.ffffff where v stands for actual values that you add to the
x or y (anx, any) positions of the object for each call to animate(), and
f stands for the fractional part.  By using a fractional part, you can
specify the speed of an object in increments as precise as 1/64th of an
interval.

If you set the value of xvel at 0x0001, it will take 64 calls to the
animate() routine before the system will modify the object's x coordinate
position by a step of one. The system constant ANFRACSIZE can be used to
shift values correctly.  So if you set the value to (1 << ANFRACSIZE), it
will be set to 0x0040, the value required to move the object one step per
call to Animate(). The system constant ANIMHALF can be used if you want
the object to move every other call to Animate().

Each call you make to animate() simply adds the value of xaccel to the
current value of xvel, and yaccel to the current value of yvel, modifying
these values accordingly.