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

2015/4/25

How do you switch between world to view & setup instances (Actors)?

alwanammar alwanammar

2015/4/25

#
Hello guys, i need some help about how to switching world in greenfoot. Currently i am making a simple game that needs more than one subclasses of World class. The problem is, after i've finished setup an actor on main menu (first world class) and make the second class.. I dont know how to put the actors inside the second world class. I've been double clicking or right click the second world class but the world view still on the first class. Sorry for a noob question :)
danpost danpost

2015/4/25

#
Did you subclass World with your second subclass (or did you subclass your first subclass with it)?!! Did you try right clicking on the second world class with selecting 'new <SecondClassName>()'?
alwanammar alwanammar

2015/4/25

#
great! thanks a lot dan! but new <classname>() quite a bit unfamiliar syntax/method(?) to view next panel to noob like me haha
danpost danpost

2015/4/25

#
You should see a bunch of 'new <classname>()' occurrences in the 'prepare' method of your first world class code. You should familiarize yourself with the code that is produced when you "save the world". Any time you use the 'new' keyword, you will be creating a new instance, or object, of the 'classname' type specified. When you compile or reset your project, a new instance of your initial world class is created automatically. When you create a new world manually (like you did to show your second world), you are making it the default initial world. You will have to manually create an instance of your first world later to return to it being the default initial world again.
You need to login to post a reply.