I have created each level but i need to connect the levels together, for example after defeating/destroying the last enemy on the first level i want a code that allows the game to move onto the next screen. how do i do this? :)


1 | if (!getObjects(LevelComplete. class ).isEmpty()) Greenfoot.setWorld( new Level3()); |
1 | if (getObjects(car1.. class ).isEmpty() && getObjects(car2. class ).isEmpty()) addObject( new WorldInformer(), 0 , 0 ); |
1 2 3 4 5 | if (!getObjects(LevelComplete. class ).isEmpty()) { Greenfoot.delay( 100 ); Greenfoot.setWorld( new Level3()); } |