This site requires JavaScript, please enable it in your browser!
Greenfoot back
dark_sky
dark_sky wrote ...

2012/5/16

Changing Levels

dark_sky dark_sky

2012/5/16

#
Hello everyone, I'm coding a little platforming game which contains several levels. To do that, I wrote a "BaseLevel"-class which holds objects which appear in every level (for example a life counter). Then the levels are subclasses of BaseLevel. The levels themselves have a prepare() method, which adds platforms etc. to the world. In my player class, I defined a method which is being called when the player intersects with a "LevelDoor". I use Greenfoot.setWorld(...) to set the new world. Now my question is, how to make it possible to go to the next level. I only get it working with a constant level, like Greenfoot.setWorld(new Level2()). Maybe you can help me. Thank you George
erdelf erdelf

2012/5/16

#
what do you exactly mean with constant level? I would program it so, that the constructor of the door needs an int and with switch-case you can change the world then.
dark_sky dark_sky

2012/5/16

#
Sounds good, thank you for your help!
You need to login to post a reply.