Hey,
I used one of the examples on this site to switch from the current to the next level.
Our first problem is that greenfoot doesn't load the first world but it loads the second at start. So we have to start at level2 thats a little problem but our other problem is that we can switch from the current world to the next (from 2 to 3) but than it loads everytime level 3.
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | if (getX() == getWorld().getWidth()- 1 ) { switch (level){ case 1 : level = 2 ; getWorld().removeObject( this ); Greenfoot.setWorld( new Level2()); break ; case 2 : level = 3 ; getWorld().removeObject( this ); Greenfoot.setWorld( new Level3()); break ; case 3 : level = 4 ; getWorld().removeObject( this ); Greenfoot.setWorld( new Level4()); break ; } } |