
07-20-2010, 08:16 PM
|
Somewhat rusty
|
 |
Join Date: Mar 2001
Posts: 5,059
|
|
otoh if you know the destination you can just take the vector to there, normalise it and then multiply it with how far you want to move
distx = 32 - player.x;
disty = 32 - player.y;
sqrtdist = sqrt(distx^2 + disty^2);
dx = r * distx / sqrtdist;
dy = r * disty / sqrtdist; |
|
|