player.x and player.y represents the player position
Code: Select all
posx = mouse.x - player.x; posy = mouse.y - player.y; a = atan2(posy,posx);
I got a couple of questions.
1, This is in radians, how can I change it to degrees?
2, how can I make my character move in a direction in degrees?
3, Is this correct? I suck at maths
4, If it is correct, is there a better way?