GRANDface Dev
Member
Hey Community!
Firstly, here's a video of my problem:
As you can see I have an object that "looks" at the mouse, the hammer. But as I my mouse gets closer to the origin point of the object it seems like the object starts to switch direction each frame.
Here's my code:
What I guess is maybe the value stored in dir isn't a full integer and thats why it starts switching directions?
Can it be fixed with flooring the variable or something like that?
Why is this issue happening and is there a way to fix it?
Thanks a lot for your help guys!
Firstly, here's a video of my problem:
As you can see I have an object that "looks" at the mouse, the hammer. But as I my mouse gets closer to the origin point of the object it seems like the object starts to switch direction each frame.
Here's my code:
GML:
if(mouse_x < x)
{
image_yscale = -1;
with(creator) { image_xscale = -1; }
}
else
{
image_yscale = 1;
with(creator) { image_xscale = 1; }
}
dir = point_direction(x, y, mouse_x, mouse_y);
direction = dir;
image_angle = direction;
Can it be fixed with flooring the variable or something like that?
Why is this issue happening and is there a way to fix it?
Thanks a lot for your help guys!