Angle Rotation

Blitz3D Forums/Blitz3D Beginners Area/Angle Rotation

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've got this really simple problem, yet I just can't seem to figure it out.

I have two integer angle variables that are used to represent 0-360 degrees.
The first tries to be the same as the second variable by adjusting per game loop

So I have something like:-

if a > b then
a=a+1
else
a-a+1
endif


Except when a is close to b and b goes past 0 to 359 angle a thinks that angle b has suddenly become massive so it goes the long way round to 359 instead of realising that it can move below 0 as well.

I came close by saying that when they're over 180 degrees do something like 360-a.
But it didn't work fully and I just can't seem to figure out how I can overcome this.

Can anyone help? :)