A velocity encompasses both speed and direction in a single vector. I'm a little bit confused about how to separate the two.
I have 2 creatures. The first is located at position (x1, y1). The second is located at (x2, y2).
I would like the first creature to move towards the second creature, so I get the vector from creature1 to creature2 as so:
velocity = (x2 - x1, y2 - y1)
Then I normalize the vector using the distance between the 2 points like so:
velocity.x = velocity.x / distance;
velocity.y = velocity.y / distance;
If I use this as my velocity, the creature will move in the correct direction but it will be moving too fast. How can I control the speed of the creature without changing the direction? I would like for creature1 to move in the direction of creature2 at a constant speed which I choose.
What you have written is not strictly speaking the velocity vector, but rather the displacement vector: $d=(x_2-x_1, y_2-y_2)$. If you normalize this, though, you'll get a unit vector in the same direction as the velocity vector:
$\ \ \ v=(v_1,v_2 )$ where $v_1={x_2-x_1\over\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} }$ and $v_2={y_2-y_1\over\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} }$.
You can impose any speed you wish by multiplying $v$ by a positive constant: $v_a=(av_1,av_2)$ will still have the direction of $v$, but the speed now is $a$.