Hi. I need calculating distance between positionX & destinationX.
That are my codes but not perfectly works.
Distance Formula
Waiting your helps...
That are my codes but not perfectly works.
Code:
float Distance = Formula.Distance (posX, 0, directionX, 0);
float waitTime = (Formula.Distance (posX, posY, directionX, directionY)) * 10000f / (((Speed * (Speed * 1.05f)) / 100f) + ((20f / Speed) * 105f));
float Interval = (waitTime / Distance) * 0.1f;
Code:
public static float Distance(float posX, float posY, float directionX, float directionY)
{
double gamedistance = Math.Sqrt((directionX - posX) * (directionX - posX)) + ((directionY - posY) * (directionY - posY));
return float.Parse(gamedistance.ToString());
}