Basically, I have a method in the class FriendlyProjectile called getDamaged() that returns the damage which is set in a subclass with a method in FriendlyProjectile. Then, in my GoalMover class, there is a line of code that goes like
if(isTouching(FriendlyProjectile.class))
{
health = health-friendlyprojectile.getDamage();
}
However, at the same time, in my FriendlyProjectile class, i have another method that goes like this
if(isTouching(GoalMover.class) || hitEdge())
{
getWorld().addObject(projectile,getX(),getY());
getWorld().removeObject(this);
}
which basically just removes the projectile if it hits a GoalMover or the edge of the world.
However, right now, the damage that is being returned from getDamage() is always coming to be 0 because I THINK, when the FriendlyProjectile hits a Goalmover, it is removed before the GoalMover can call upon the getDamage() method, can someone help me and tell me what i can do here?
