So below is my code, and whenever World sets to finalevel, error pops out and says cannot find door1, which is in level 1.
How do i fix this?
private void NextLevel() { if (isTouching(portalout.class)) { getWorld().addObject(new boss(), 200, 300); } if (isTouching(portal1.class)) { getWorld().removeObject(this); Greenfoot.setWorld(new finalevel(this)); } if (isTouching(door1.class)) { getWorld().removeObject(this); Greenfoot.setWorld(new level2(this)); } }