Here's a simple method of creating camera zones that only uses two events:
http://dl.dropbox.com/u/529356/cameraZones.cap
(v0.99.72)
The zoneBorder objects (which are the red tiled backgrounds) have five pieces of information stored in each one as private variables. There is xMin, xMax, yMin, yMax, and "myZone."
The global variable "zone" indicates which camera zone the player is in. It starts off in zone 1 as the default. The system looks up the zoneBorder with the myZone variable that matches global('zone') and uses the min and max info to restrict the scrolling. Notice that even though there is empty black space in the layout, you don't see any at runtime.
When the player touches a zoneBorder it changes the global('zone') variable. They're set a space apart so that a player can't touch one and then turn around without un-touching the old zoneBorder, which could cause the camera to get lost. Notice also that the "inside" areas have identical information in the zoneBorder objects at either end. The two rooms in the middle each have two zoneBorders because there are two entrance/exit points that lead to the same space.
Anyway, here's how the scrolling works:
System: Scroll to X:
clamp(player.x, zoneBorder.Value('xMin'), zoneBorder.Value('xMax'))[/code:13k9cl0z]
"Clamp" just means we're restricting a number between two points. We want to follow the player, but not above or below certain limits. it works like this:
clamp(target value, minimum value, maximum value)
If the target value is smaller than the minimum, then clamp will return the minimum. If the target value is larger than the maximum, then clamp will return the maximum. If the target is between the two, then everything is normal.
So, clamp says to follow the player, but if the player goes over or under the limit, then stop following. You can do this for both the X and Y axis, making single-room areas (like zone 1 and 3), one-way scrolling areas (like zone 2's horizontal-only scrolling) or two-way scrolling areas (like zone 4).
For more information on clamp() and other expressions, check out the wiki.
The numbers for the x and y values in the zoneBorder variables were just put there with a little math. You have to do a little figuring in order to set them up. For instance, if you have a screen that is 320x240 pixels (like in the example) then you will want to stop the camera half the distance away from the edge of the room, which is 160 pixels in the x axis and 120 in the y. This makes it so when you are half a screen away (that is, "centered" on the end of the room) then the camera will stop. Once you've figured out the numbers for the current zone, just type them in to the border object's values and you're done.
Also... I made the camera events on a second event sheet to show how to use external events. Notice under the Project tab there is a "cameraSheet" event sheet. You can open the sheet by double-clicking the icon.
This sheet can be used on any layout. I've included it in the Layout 1 Events by right-clicking in the event editor and selecting "Include event sheet."
Also note that you could control lots of other things with the global('zone') variable. You could make enemies active only when the player is in the same zone by checking if an enemy's "myZone" variable matches up, and set any enemies in other zones dormant. This could cut down on processing or simply keep them from chasing you into places where they shouldn't. You could activate ambient sounds or new music based on what zone you are in, or trigger other environmental things. Or start up a boss intro when you walk into a boss room, etc.
Anyway, if you have any questions, feel free to ask.