I can't understand why this is happening with my 2D object. When i set direction to 0,45,90,180 etc. it goes in the direction it's suppose to ie 0=right,180=left. But when I add direction+=1; to the update method it starts going funny. If it starts at 0 moving right by the time it gets to 180 direction it's only actually going 90deg (down) but when it gets to 360 it's only going left instead of doing the full circle but then it stops moving and starts randomly moving in the opposite direction anti-clockwise. Is it a translation thing on the opengl?
direction is float 0-360deg
float radian = (float) Math.toRadians(direction);
position.x = (float) (position.x + speed * Math.cos(radian));
position.y = (float) (position.y + speed * Math.sin(radian));
I can't understand the logic why it would do that or is my code completely useless?