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

2013/11/26

Connecting Rooms Request

askgriff askgriff

2013/11/26

#
Hi Folks! Danpost did a great example of this (http://www.greenfoot.org/scenarios/9849) idea where you have 9 rooms that are connected in a 3x3 grid. I'm looking for a way to do this in a simplified form where I can teach a class of beginning programmers how to make different "rooms" within a scenario like this. They will basically make each of the rooms (or worlds -- something like Zelda) and as you walk from one to the other it changes. So why don't I just use Danposts? To be honest, it's a little abstract for beginners. Is there an "easy way" for them to just make different "worlds" and have one open when someone hits a specific "world edge"? Or if there's a "ladder" or "stairwell" or "cave", a different world would open?
danpost danpost

2013/11/26

#
If you do not mind having the rooms each created anew each time one is entered, then you can program each world to go to the different worlds or have actors that use the 'instanceof' keyword to determine which world is active which in turn would determine which world to proceed to. However, no matter which way you decide to go, it would take some extensive coding (probably more than in my scenarios).
askgriff askgriff

2013/11/27

#
Okay. Perhaps we will move on to something else, then. It's our first year of coding so I'm trying to do some projects that will let them move in different directions. I'm trying to give them a "platform" that they can build their own games on for now.
danpost danpost

2013/11/27

#
I did upload one more room changing scenario. The rooms are created anew each time the character enters them. It has a simple 'start-up' world that is basically used to hold the main character. It can be made to hold other actors or stats; or, they can be held within the main character. Anyway, the world changing code is within each world (which is more what you were looking for). You can find this scenario here. To use actor objects as portals to the different worlds would require each world to keep references to each portal object and the world 'act' method would need to call a portal method on each portal to see if the main actor is intersecting it. I will upload one final scenario to demonstrate this in the near future. EDIT: the final demo is here.
You need to login to post a reply.