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

2014/3/6

Set a new world without the "new"

Mimagic Mimagic

2014/3/6

#
Is there a way in which i am able to change world and then come back to the world i was previously in and the actors would still be in the same positions such as Greenfoot.setWorld(world1()) and not setWorld(new world1()); is there a way to do this, im making a game and need to go from one world to another just need a little help, Ash
danpost danpost

2014/3/6

#
Sure. Just pass a reference of the old world to the new one. Have the new one save it in a field to be used in the 'setWorld' method to return to. All the actors in the old world will be exactly where they were when you left the world. That is, provided no changes were made programmatically while it was inactive, which is possible to do. I have several scenarios uploaded that change worlds and then return. Some are TextFile Viewing World Class, Pause World Class and Crayon Babies: A World Changing Demo.
Mimagic Mimagic

2014/3/7

#
Thank you very much, this is for a project im doing for college!
You need to login to post a reply.