# Get rotate angle using a formula

I am developing a game that is being played on a board with the top first tile having the coordinates [0,0], the next one has [0,1], second row has [1,0]... and so on (most likely this would be a standard but im not sure...).

When an object is to move around the board, it should first rotate to a specific angle - meaning if it is moving north North - it should point to the default angle 0, NE is 45, E is 90, and so on.

How would I get this angle based on where the object is moving, but using 1 formula?

So if an object is to move NW (up and left), on the grid that would mean the destination is [y-1, x-1] in reference to where it is now [y,x] ( [row, column] ).

I know I could use 8 statements and say if destination == [y-1, x-1] then angle = 315, but I was wondering if there is a specific formula for this? Im guessing yes but I never loved trigonometry...

  Vector2 V = Target - Source;

• This isn't really a single formula, since you'd still need to use some kind of lookup table to get the Target and Source angles. – MichaelHouse Aug 6 '13 at 0:11