0-360 Y degree from Vector3.Angle

Having trouble with my pixel-movement code, which I'm pretty sure is having problems with Vector3.Angle Made in java, kind of stumped.

//loc = Vector2, this moves towards the endpoint.
//endpoint = Vector2, this is stationary. 

 var dir_difference : float = Vector3.Angle(Vector3(loc.x, loc.y), Vector3(endpoint.x, endpoint.y));

I want dir_difference at this point to be 0-360, but it's instead returning 6-9, passing the endpoint without changing very much.

The rest of my code should work well enough, since it's splitting it down to a 0-7 int which I use to move the pixel.

//dir = last direction the pixel moved in. 0-7
dir_difference = Mathf.Repeat  (Mathf.Round(dir_difference / 45 ) , 8); //should return 0-7
dir_2 = dir_difference;
dir_difference = Mathf.Abs(dir - dir_difference); //total difference between angles.  Tells me if it needs to move left or right, and how soon

EDIT: To clarify, I'm looking for something that would return something akin to

225 270 315
180 xxx 000
135 090 045

The arguments to Vector3.Angle are themselves directions; you seem to be passing in positions.

Try subtracting the two positions to get the vector: vec = endpoint - loc

The length of this vector is the distance between the two points; the "slope" of the vector is the direction to travel. You can then convert this into an angle using the Vector3.Angle method. But, you need a starting angle. For example, you might choose the X-axis as your starting angle:

var angle : float = Vector3.Angle(Vector3.right, vec);

You can then use this angle to assign an integer (0-7) to the direction as you had planned to originally. (Although, that code may also need tweaking. What's dir_2 for? Is dir the last calculated direction?)