You can make animations with a complex sprite, so you can make it walking, running, punching, dancing, etc.
Between keyframes, the application calculates the tweening.
All here is OK, but I am having problems with that:
for the tweening I calculate the difference of 2 different angles. I use that code. It have to return the minimum distance. For example, I have an angle of 100 degrees, and other one of 130 degrees. The difference can be +30 or -330 degrees, depending of the direction you choose for tweening. The problem is that I don't know the exact formula for calculating that difference angle.
I use this code:
CODE
//Argument0 - Angle from
//Argument1 - Angle to
var _a,_b;
_a=argument1-argument0;
_b=-(359-argument1+argument0);
if _a<0 then _a+=360; else if _a>=360 then _a-=360;
if _b<0 then _b+=360; else if _b>=360 then _b-=360;
if abs(_a)>=abs(_b) then return _b;
else if abs(_a)<abs(_b) then return _a;
//Argument1 - Angle to
var _a,_b;
_a=argument1-argument0;
_b=-(359-argument1+argument0);
if _a<0 then _a+=360; else if _a>=360 then _a-=360;
if _b<0 then _b+=360; else if _b>=360 then _b-=360;
if abs(_a)>=abs(_b) then return _b;
else if abs(_a)<abs(_b) then return _a;

The problem appears when the angle from is bigger than the angle to. For example, if I have an angle of 350 and the other one is 100, the difference will be -250 or 110. My code can't calculate that.
Help please
EDIT: I use degrees from 0 to 359. I know that GM can handle degrees higher than 359 or lower than zero, but I convert it.