create a new room with this background:
give the room the description
rmOutsideDarkBuilding, and add the name/ID to
Rooms.ash (see previous tutorial section "project management: using memorable room name-IDs in scripting")in the room editor, select
Show this room's >
Walkable Areas, and using the Line tool, draw lines line this:
make sure the lines all join together & touch the edges of the screen on the right and at the bottom
next use the Fill Area tool, and click inside the area:
(if the whole background fills with blue instead, hit Ctrl-Z to undo the fill and look for gaps in the line)next select
Show this room's >
Edges. four yellow lines will be shown, two vertical & two horizontal
use the mouse to drag the line running down the right side of the screen inwards (to the left) a little bit:
also while you are here, place the mouse approximately here - near the right edge, but left of the yellow line, on the ground opposite the door entrance:
...and note the two
Mouse Position values in the top left. this is going to be the entrance point that the player character appears at.
in the Room Events, create an event handler for
Walks off right edge:
function room_LeaveRight()
{
player.ChangeRoom(rmMudlands);
}
this means that when the character walks past that yellow line, the game will change to the second room we added (
the one that looks like this)
also add a
Enters room before fade-in event:
function room_Load()
{
if (player.PreviousRoom == rmMudlands)
{
player.x = 290;
player.y = 150;
}
}
...using the entrance point values noted earlier.
now, open the Room Editor for that other location, with the building in the distance. edit the room Edges, and this time drag the
top edge down to below the horizon. switch back and forth between
Edges and
Walkable areas - you need to make sure that some of the walkable area is
above the yellow line, otherwise the player won't be able to use the exit, so you may have to edit the walkable area a bit to ensure that:
use the
Mouse Position thing to get an entrance point position just below the yellow line, in front of the building in the distance:
add an event for
Walks off top edge:
function room_LeaveTop()
{
player.ChangeRoom(rmOutsideDarkBuilding);
}
there will already be a
room_Load() function in this script. add this code inside it, at the end:
if (player.PreviousRoom == rmOutsideDarkBuilding)
{
player.x = 205;
player.y = 75;
}
ok, that should be it -- try the game and see if you can walk to the distant building, then back again