
12-13-2012, 09:19 AM
|
|
the fake one
|
 |
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
|
|
Quote:
Originally Posted by Stowen
So that would include determining players direction, correct? I tried the calculating distance, but I cant really figure out an efficient formula without figuring the players direction. Could somebody help me on a formula?
|
Quote:
Originally Posted by cbk1994
Use the distance formula:
Therefore, to get distance
PHP Code:
function dist(x1, y1, x2, y2) {
return (((x1 - x2) ^ 2) + ((y1 - y2) ^ 2)) ^ 0.5;
}
|
.. |
|
|
|