so in my program, i have to save a cat by picking a cat and returning it to their owner. if i touch the cat it disappears but if i leave the world and go in it again the cat reappears. is there any way to stop this?
public void new_world() { //up if(getY() == 0) { Greenfoot.setWorld(new world2()); if (getWorld() instanceof world2) { Greenfoot.setWorld(new world3()); } if (getWorld() instanceof world6) { Greenfoot.setWorld(new world5()); } if (getWorld() instanceof world5) { Greenfoot.setWorld(new world4()); } if (getWorld() instanceof world7) { Greenfoot.setWorld(new world8()); } if (getWorld() instanceof world8) { Greenfoot.setWorld(new world9()); } } //down if (getY() == getWorld().getHeight() - 1) { Greenfoot.setWorld(new world2()); if (getWorld() instanceof world2) { Greenfoot.setWorld(new world1()); } if (getWorld() instanceof world4) { Greenfoot.setWorld(new world5()); } if (getWorld() instanceof world5) { Greenfoot.setWorld(new world6()); } if (getWorld() instanceof world9) { Greenfoot.setWorld(new world8()); } if (getWorld() instanceof world8) { Greenfoot.setWorld(new world7()); } } //left if(getX() == 0) { Greenfoot.setWorld(new world6()); if (getWorld() instanceof world2) { Greenfoot.setWorld(new world5()); } if (getWorld() instanceof world3) { Greenfoot.setWorld(new world4()); } if (getWorld() instanceof world6) { Greenfoot.setWorld(new world7()); } if (getWorld() instanceof world5) { Greenfoot.setWorld(new world8()); } if (getWorld() instanceof world4) { Greenfoot.setWorld(new world9()); } } //right if(getX() == getWorld().getWidth() - 1) { Greenfoot.setWorld(new world1()); if (getWorld() instanceof world5) { Greenfoot.setWorld(new world2()); } if (getWorld() instanceof world4) { Greenfoot.setWorld(new world3()); } if (getWorld() instanceof world7) { Greenfoot.setWorld(new world6()); } if (getWorld() instanceof world8) { Greenfoot.setWorld(new world5()); } if (getWorld() instanceof world9) { Greenfoot.setWorld(new world4()); } } }