So here my code...
This is the bullet that's hitting the tank and doing damage. It says the error occurs at "m4.damage(10)", when the tank took enough damage and was removed. I'm assuming it was trying to use that method but it's not there cause it was removed? I have no idea how are to fix this, I tried to call the removing of the bullet in the tank class and made it the last thing that happens, but it was not fixed :(
public void act()
{
count=count++;
List<M4> tank = getObjectsInRange(600, M4.class);
M4 m4 = (M4)getOneIntersectingObject(M4.class);
for(M4 tanks:tank)
{
tankX=tanks.getX();
tankY=tanks.getY();
}
move(-10);
if(count<5)
{
turnTowards(tankX, tankY);
setRotation(getRotation()+180);
count=10;
}
if(isTouching(M4.class))
{
m4.damage(10);
}
if(getWorld()!=null &&isAtEdge()|| m4!=null)
{
die();
}
}
private void die()
{
getWorld().removeObject(this);
}
