Well, I must clarify that I have never used Greenfoot before, seems like an interesting tool. However, I think I have something that can help you in your endeavor. I tinkered around with the 'balloons' scenario that came with Greenfoot and found some interesting things. First, some thoughts.
1. Each Instance of the Target subclass has it's own act() method which takes away the need to create a list of all of them. For instance if you had this instead:
public void act()
{
int myX=aboveThis.getX();
int myY=aboveThis.getY();
if((getX() == myX) && (getY()<myY))
setLocation(getX(), getY()+25);
getWorld().removeObject(this);
if (distance <= 15) // change this to distance formula***************
hitScore += score;
hitScore.setImage("explosion.gif");
}
it would work all the same.
2. As for this distance formula, unless you absolutely need to create one, I see no reason to do so. As I said before I tinkered with the 'balloons' scenario and came across the getOneIntersectingObject() method in the documentation, which seems to take care of the distance formula, so long as the two objects need to touch.
3. With this in mind and this is largely based off the the 'balloons' scenario, I would suggest only coding in movement in the act() method for the Target subclass and have the Bomb subclass figure out if there is a hit.
So, there are a few built-in methods that can handle intersections in Greenfoot and I would suggest using one of those. Here is the basic idea of how that would be done.
I would probably put something like this within the Bomb subclass.
public void act()
{
Target target = (Target) getOnIntersectingObject(Target.class); //Looks to see if a Target object is intersecting the current bomb object
if(target != null) { //If an object was found then blow it up.
target.destroy();
}
}
This is by no means the complete code and as I said before this is only good if you don't have to write your own Distance method. One final note, I don't know what aboveThis refers to. Yeah that's about it, hope this can help in some way.