could you please tell me how to change worlds between levels when my enemy is dead


1 2 3 4 | if ([Boolean/Integer Name] == [ 0 / true ]) // use Integer if there is more than 1 enemy/multiple enemy classes { Greenfoot.setWorld( new [World Name]()); // This is the world changed to } |
1 2 3 4 | if (getObjects(Enemy. class ).isEmpty()) { // change worlds here } |
1 | world = newWorld |
1 | Greenfoot.setWorld( new World2()); |
1 2 3 4 5 6 | if (getObjects(enemy. class ).isEmpty()) { showText( "You Are Proceeding to the next level" , 400 , 300 ); Greenfoot.setWorld( new MouseWorldLevel2); } |