Im using this code to remove an actor and create a new one once the first one is removed but i get a null pointer each time it is removed. What can i do to fix this?
public void create()
{
if(getX()==0)
{
getWorld().removeObject(this);
}
if(getWorld().getObjects(AlienBoss.class).isEmpty())
{
getWorld().addObject(new AlienBoss(),400,25);
}
}

