Re: [stella] Angular movement

Subject: Re: [stella] Angular movement
From: Manuel Rotschkar <cybergoth@xxxxxxxx>
Date: Wed, 14 Jan 2004 08:02:56 +0100
Hi there!

>> E.g. the ball speed should be 3 pixel/frame, for an 
>> angle of 30° you get a speed of 1.5/2.6 (x/y) 
>> pixels/frame. Converted into fractional values you 
>> get 1/128 and 2/153.

> This is what you mean by a sine wave?  I already have 
> these two tables but while I can get an accurate angle 
> of movement, the speed is not consistent from angle to 
> angle.

It should be just 

sin(30°)*3*256 and cos(30°)*3*256

which is:

384 and 665

If you convert these into 16 bit binary numbers you get:

00000001:10000000 and 00000010:10011001

which is

1/128 and 2/153 like Thomas said.

If you have an algorithm for calculating the tables, 
then you get from:

384 and 665


1/128 and 2/153

by dividing through 256 for the higher byte and using 
the rest from that division for the lower byte.

To test your generator, just try this 30° example.


Archives (includes files) at
Unsub & more at

Current Thread