Im new to greenfoot and have to create a game with levels. I have tried a counter but it does not seem to work. Is there another way to do it?


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | int current_level = 0 public void setLevel( int level) { current_level = level; clean_world(); switch (level) { case 0 : level_one(); case 1 : level_two(); } } public void nextLevel() { current_level++; setLevel(current_level); } public void clean_world() { removeObjects(getObjects(player. class )); } public void level_one() { System.out.println( "level one" ); } |