]If you would like to center your rotation, you could use the "round" feature and a simple IF statement to offset the final frame of your rotation.
Example:
- Code: Select all
int MyDirection;
angle = direction(xscreen, yscreen, xmouse, ymouse);//direction toward mouse position//
MyDirection=round(angle/360*nframes);
if (MyDirection=='max frame') //*'max frame'=last frame # of animation sequence, example: 16 frame animation, 'max frame'=16*//
MyDirection=0;
animpos=MyDirection;
This will center your actors rotation for each frame. For instance on a 16 frame rotation, you actor will face directly right from approx. 349.5° to approx. 11.4° instead of 0° to 22.5°.
I'm sure there is an easier way but this works great for all my games.
Hope this helps.