Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
101 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

Creating Virtual Worlds


Section 3 - Three rooms over the edge

Now we want to have the upper room extending to the right. Also, there is still a wall between the two room, so me must make a way for the player to pass through. Giving him a big hammer won't cut it here (pun intended ;).

Now if we just double the world's size along the Y axis (aka its width), we get two rooms that are still equal in size. Thats not going to work. There is more than one solution but we'll go with the following: What we do now is to split the lower cell (which contains room 2) into two cells. The left one contains room 2, and the second one is just an empty cell which fills up the space:

$lower = cell ( name => "lower part", size => 16, 
   div => inY(),                                         # line 1
   cells => [ $room2, emptyCell (16), ], );              # line 2

And instead of room 2, we add $lower to the world:

$world = cell ( name => "Hello World", room => $room, 
  div => inX(),                                          # line 3 
  cells => [ $room1, $lower, ]);                         # line 4

That's all the changes we need for now.


3: Two rooms, with corner

As you can see in line 2, you don't need to store the result of the cell (or in this case emptyCell()) call, but you can insert it directly. Oh the wonders of Perl :-)



Another brick in the wall


Contents
  Introduction
  What you need
  How it was...
  A single room
  Two rooms
  Three rooms over the edge
  Another brick in the wall
  Doorways to Heaven
  Redefine the world
  Links, routes, etc.
  More ideas
  Afterword

  Printable version
  Discuss this article