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

Comments for Multi Level demo

Return to Multi Level demo

A new version of this scenario was uploaded on Thu Jun 09 15:15:11 UTC 2011 Fixed small problem with levels having different screen sizes.
A new version of this scenario was uploaded on Thu Jun 09 15:25:55 UTC 2011 Sorry - forgot the include the source. It's there now.


Perfect Mik - it works out just fine.
A new version of this scenario was uploaded on Thu Jun 16 10:47:57 UTC 2011 The demo now shows how to move actors between worlds. The previous version created a new Pengu actor in each world. I have now modified this so that the SAME Pengu actor object moves from one world to the other. This may be important if you want to keep some state (such as a score) in the actor without losing it when moving to other levels.
A new version of this scenario was uploaded on Thu Jun 16 10:49:35 UTC 2011 Oops - added source again.


WOOOOOOOOOOOOOOW!!!!! I have spent so long trying to emulate this functionality. This really does save my life :)
Lol i actually *did* implement this functionality in my Nightmare Scenario right before this was updated XD Doh!


there's 1 thing pissed me out about greenfoot , is that , like in this game, when pengu jumps from the cloud , and hits the middle of the ground(the soil beneath grass ), it should fall, rather it stays and if we press "jump " it goes to surface,, can anyone tell me, how to fix this?? or how to make an image like a solid object ?


The code is already at your feet, fool around, imagine what happens when you change -8 in -40 or whatever, happy coding roflol !!!


@bijoy508 Are you asking why the penguin can move into the side of the cliffs and jump through the ground? I'd imagine making those 'cliffs' or sides of some object to act as a wall to your character or such.


I'm having an issue when switching between worlds, where I have two worlds, and a common actor in between. Eventually when switching between the two worlds, I inevitably come across a Java out of memory error. I'm wondering if there's some sort of issue deleting the resources of each world in the setWorld method.


Hi, Thanks for the scenario. It was very helpful. I was wondering if sombody could give me some tips. Where does Greenfoot decides which world to start with. If I duplicate the first world, which I have created in the scenario (under a different name), Greenfoot still starts with the original world. How do I control with which world to start (without too complex coding). Richard


Jinno - post something in the discussion forum, ideally with a link to your scenario which demonstrates the problem. Richard - whichever world you interactively instantiated (right click world class, "new XyzWorld()") is the one that Greenfoot remembers as the default world. (for more help, post in the discussion forum).


Hi davmac, thank for the reply. Sorry, I might missunderstand you. I created three worlds. The default one is the one I created first. How can I convince Greenfoot to start with the second or third world I created. In the example scenario on this page. How could we get Greenfoot to start with Level 2?


Richard, As per my comment, to set the default world class: ... right click world class, "new XyzWorld()" ... I.e. first right-click on the world class (in the class tree) and then click "new XyzWorld()" (where "XyzWorld" is an example and will change depending on the class name). And please: (for more help, post in the discussion forum).


MIK !!! Please look at my Thread in the Forum ! MrIncredible


How does it know its going to start from level1 ?? I mean where is the code that tell the world to start the game from the first level ??? Please let me know :) thanks


While you are developing, you can instantiate different levels interactively (by right-clicking your world subclass and selecting "new ..."). The world which you last instantiated interactively will be the one the scenario starts with.


Glad someone answered. I was trying to make another super class for my levels (subWorlds), since they all share stuff like background, but i faced some issue since they are all children of that class. I didn't know how to call them, so i make it simple, they are all subclasses of World. guess will try now to see how it works.


Hello I am creating a shooting game and i was wondering how to proceed to the next level once all the enemies are gone, thanks


this is such a bad game


I implemented this as a cheat to send the player into a blank room in my game, and it was working. However I was changing the layout of the room a bit and now the scenario freezes every time I use the cheat. I've tried changing the layout back to how it was before along with a multitude of other things, but it just won't work anymore. Does anyone know why?
@Entity1037 It would work better if you posted a discussion about this, with some code instead.
Thanks this really helped :)


When I go backward in the second level, it doesn't go to first


delete the world