Creating Virtual Worlds
Section 3 - Three rooms over the edgeNow 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. 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 :-)
|