danpost wrote...
When you add a Reload2 object to the world, you are also adding a One object to the world.
public void remove()
{
if (ammocounter > 0)
{
remove(Reload2.class);
if (getWorld() == null) return;
}
}public void remove(Class clss)
{
Actor actor = getOneObjectAtOffset(0, 0, clss);
if(actor != null)
{
getWorld().removeObject(actor);
if (getWorld() == null) return;
}
}// instance field (in class One) Reload1 reload = new Reload1(); // in 'act' method (or a method it calls) if (ammoCount == 0 && reload.getWorld() == null) getWorld().addObject(reload, /* x, y */ ); if (ammoCount > 0 && reload.getWorld() != null) getWorld().removeObject(reload);