I have this code where everything gets removed, but i need for all except one actor to be removed, how do i do that
1 2 3 4 5 6 7 8 9 10 11 | Actor collided = getOneIntersectingObject(End. class ); if (collided != null ) //if you have not run into it { World world = getWorld(); world.removeObjects(world.getObjects( null )); //removes all the objects in the world; world.addObject( new Congrats(), world.getWidth()/ 2 , world.getHeight()/ 2 ); Greenfoot.stop(); Greenfoot.playSound( "Pacman.wav" ); } |