so i have 2 bullet classes 1 bullet class for the enemys and one class for the hero and i have barriers when either bullet class hits the barrier the bullet and the barrier and they have the same code but im getting an error under one this is my code right now
and the error says (java.lang.illegalStateException: Actor Not In world. An attempt was made to use the actor's location while it is not in the World. either it has not yet been inserted, or it has been removed.) so the game stops when the bullet hits the barrier but it is fine when the Marinebullet hits the barrier i need help please
public void act()
{
Actor Bullet = getOneObjectAtOffset(0, 0, Bullet.class); //this code removes the bunker and the bullet when they make contact
if (Bullet != null){
getWorld().removeObject(Bullet);
getWorld().removeObject(this);
Cruiser.istoast = false;
}
Actor Marinebullet = getOneObjectAtOffset(1, 1, Marinebullet.class); //this code removes the bunker and the bullet when they make contact
if (Marinebullet != null) {
getWorld().removeObject(Marinebullet);
getWorld().removeObject(this);
}
}
}