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

2015/2/25

Re-initialyze World

Twentyonestreet Twentyonestreet

2015/2/25

#
Good afternoon, everyone. Is it possible to re-initialyze existing world? I do this:
Greenfoot.setWorld(new Base());
And it just returns the world to the same moment it ended in. But I need to put it in the initial position with all Actors in initial positions.
Twentyonestreet Twentyonestreet

2015/2/25

#
All objects return in initial positions, but classes do not "start from the beginning"
Super_Hippo Super_Hippo

2015/2/25

#
Do you use static fields? If yes, they aren't reset when you create a new instance of the world. Either change the field to non-static or initialize them in the constructor, so they will be set to the initial value when a new instance is created.
Twentyonestreet Twentyonestreet

2015/2/25

#
Super_Hippo, thank you, everything works
You need to login to post a reply.