# flying spaceship, math=hard

This is a discussion on flying spaceship, math=hard within the Game Programming forums, part of the General Programming Boards category; First let me say I SUCK WITH MATH and am using mingw32 with allegro. Im making this space melee fighting ...

1. ## flying spaceship, math=hard

First let me say I SUCK WITH MATH and am using mingw32 with allegro.

Im making this space melee fighting game where two ships fight, when you press right or left it rotates to the right or left, I can do this pretty easily because I just use rotate_sprite but the problem is when I want to accelerate, how do I make it so the ship moves the proper amount of X, Y spaces depending on the angle. btw allegro does degrees weird, 256 is like 360, so 64 would be like 90, 32 like 45, etc...

2. Trigonometry

NewXpos = OldXpos + SpeedPerFrame * cos(Angle * PI / 128);
NewYpos = OldYpos + SpeedPerFrame * sin(Angle * PI / 128);

If 'Angle' is expressed in your "256-degrees" system

3. gracias