In your situation you need a simple subtraction, with a normalization.
vectDistance = B - A
vectDirection = vectDistance / lenght(vectDistance)
This will give you the direction.
In LibGDX, you can use the sub
method from the Vector2
class, along with the nor
from the same class:
vectDirection = b.sub(a).nor();
To help figure out if you need to subtract A from B or B from A, try to translate (in your mind) the 'origin' to (0, 0), and move the 'target' along with it. From that perspective, the "direction" should be taken from the position of the 'target'.
Another clue that will make you notice that you used the wrong order: the bullets will fly in the opposite direction of what you're expecting ;P
B - A
? \$\endgroup\$