Paul Green
Member
Hey All,
I've tried a few searches in the forums, found a few things I've tried, but they don't quite work the way I want.
I'm using image_angle and direction and I have an object that can rotate 360 degree's, but I want it to be able to snap it too, 0, 22, 45, 67,90, etc (I know half of 45 is 22.5, but I didn't want to confuse myself even more, as maths is not one of strongest subjects) but, and this is were I can't combine code, I want it to smoothly get to that 'turning too' angle, but if you were to press the opposite key, it would stop the current rotation and go back the other way and then snap again.
At the moment, I'm using the step block to control my simple rotation with
Can anybody help me with this issue, the old grey matter isn't as good as it used to be.
I've tried a few searches in the forums, found a few things I've tried, but they don't quite work the way I want.
I'm using image_angle and direction and I have an object that can rotate 360 degree's, but I want it to be able to snap it too, 0, 22, 45, 67,90, etc (I know half of 45 is 22.5, but I didn't want to confuse myself even more, as maths is not one of strongest subjects) but, and this is were I can't combine code, I want it to smoothly get to that 'turning too' angle, but if you were to press the opposite key, it would stop the current rotation and go back the other way and then snap again.
At the moment, I'm using the step block to control my simple rotation with
Code:
var turn = keyboard_check(ord("A")) - keyboard_check(ord("D"));
if (turn != 0)
{
direction += turn * 4;
image_angle = direction;
}