I am wanting to create a method that has 2 actors as parameters and calculates the distance between the two actors.
Is there a sample of this that I can have a look at?
thanks
Canning
All you need is the distance formula and the actor location accessor methods,
public double findDistanceBetween(Actor a1, Actor a2)
{
return Math.sqrt(Math.pow(a1.getX() - a2.getX(), 2) + Math.pow(a1.getY() - a2.getY(), 2));
}