I'm not sure on how to explain vectors without things ending up more confusing than they already are, I'm not a very good tutor
If you want to know more you can google for vector math tutorials or something, but I can give some basic explanations on how to do this special case.
Think of a vector as an imaginary line going from any point A to any point B.
In a 2d system you could have a vector from x=2,y=2 to x=3,y=3. This is known as a free vector.
Then there are also bound vectors, where point A is always 0,0 (or 0,0,0 for 3d, etc). To define a bound vector you only need to know the end point because you know it will always start at 0,0
(note: I'm not exactly sure they are called free and bound vectors in English but I think they are. For the sake of this post just pretend that they are )
To get the length of a bound 2d vector you take the square root of (x*x + y*y)
A vector with a length of 1 is called a normalized vector, or a unit vector.
To create a unit vector from any given bound vector all you need to do is divide x and y by the length of the vector. Example
If v was a vector from 0,0 to 2,2 then unit_vector would be a vector from 0,0 to roughly 0.7, 0.7
struct Vector2 // I named the vector struct Vector2 to indicate it's a 2d vector
float x, y;
struct Vector2 v, unit_vector;
float v_length = sqrtf(v.x*v.x + v.y*v.y);
unit_vector.x = v.x / v_length;
unit_vector.y = v.y / v_length;
It still points in the same direction but now has a length of 1
Now if we have 2 points like you asked about in the OP (let's call them A and B), and we want to get a vector between them to know the direction from A to B we can do this
Now we know the direction from A to B, and we also know how to calculate the distance (length) between them.
struct Vector2 direction;
/* if we just take the positions directly we would
* end up with a free vector from A.x, A.y to B.x, B.y
* To make it a bound vector (starting at 0,0) we have
* to subtract A from both the starting and end point.
* (A-A=0,0) */
direction.x = B.x - A.x;
direction.y = B.y - A.y;
If we now want to move A towards B with a distance of 10 pixels per step, we would to these calculations:
Now we would end up moving point A 4.4 pixels along the x axis (10*0.44) and 8.9 pixels along the y axis (10*0.89) towards point B
/* refer to the previous sample on how to normalize a vector */
Vector2 unit_vector = NormalizeVector(direction);
/* assume the unit vector turns out to be 0.44, 0.89
* Now we add the vector * distance (10) to point A's position */
A.x += unit_vector.x * distance;
A.y += unit_vector.y * distance;
I hope this was understandable. Like I said, I'm not very good at explaining things. Especially not in English
Here is a small example of a console app where 3 "points" are chasing each other.
The code is C++ and uses windows-specific APIs but hopefully the logic will be understandable even if you can't run it.
C++ pastebin - collaborative debugging tool
Bah! Dwks types faster than me