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

2022/1/25

Remove a world

TurboCoder007 TurboCoder007

2022/1/25

#
How do I remove a world class so that I can add a new world when I want!
Spock47 Spock47

2022/1/26

#
The question is a little bit difficult to understand. So, I will give you answers to some questions and hope that one of them is helpful for you. 1. How to change the current(-ly shown) world (while the scenario is already running)? Call the method Greenfoot.setWorld with the new world as parameter, e.g.
final newWorld = new Level2World();
Greenfoot.setWorld(newWorld);
2. How can I set a different world to be the start world (=the current world at the start of the scenario)? Right click on the World class that you want to be used for the start world (e.g. NewStartWorld) and create an instance of this class (by clicking on the constructor call statement, e.g. "new NewStartWorld()"). At next scenario start, an instance of NewStartWorld will be shown as the current world from the start. 3. How do I delete the source code for my world class, so that the world list on the right side of Greenfoot GUI is empty again? Right click on your world class and select "delete". But be cautious, this means that it will be gone forever. If none of these answers solved your problem, I suggest to reformulate your question. Live long and prosper, Spock47
You need to login to post a reply.