I'm trying to make a tile-world adventure game on iOS similar to Zelda Link to the Past on SNES, and one issue I've run into is having my camera move beyond walls revealing the rooms on the other side. I like the way Zelda handled room changes where once you went through a door the screen would slide over to show the new room, but I can't figure out how they did it. I'm using Obj-C on my own tile-world engine, so I'm more interested in logic than code, but anything would help.

I'd also be interested to hear any alternative suggestions for limiting the movement of the camera. (Presently I have the position of the camera restricted to the bounds of the level being drawn, but in order to reduce loading I've decided to increase the size of levels to put multiple rooms/floors on the same map.)

Edit One of the key things that the transition I am asking about offers is the ability for the player to leave the center of the screen. I think that you lose a sense of motion or progress when the player is always dead center in the screen. My camera is designed to stop moving at the world bounds, but I'm having trouble figuring out how to define 'room bounds' within a world for the camera to stay within until triggered to move.

I also recognize how transitions break up gameplay, but when you're dealing with a top-down 2D adventure game, if you want to conceal the contents of the next room over and also allow for some range of motion free of the camera, I'm not sure what better way there is.

  • 1
    \$\begingroup\$ This is commonly called 'flick screening'. The most challenging aspect will likely be that these rooms are all on one big tilemap, but rooms that appear to be next to each other might not be adjacent on that map. It becomes much easier if you think of your world as a series of rectangular rooms rather than a big tilemap with walls. \$\endgroup\$
    – Blecki
    Aug 5 '11 at 23:34

Some games of this sort, especially ones with single-screen non-scrolling rooms (but also many with scrolling rooms!) don't actually move the camera over to the next room. They move the next room over to the camera. The math to do so is trivial but quite a few lines of code, but you can imagine the new room "pushing" the old one out of the way. If that then places the camera in a weird place, you can reset the position of the camera and the new room in one impossible-to-notice step.

If you're working in 2D and only loading a room at a time, you shouldn't have to worry about load times.

  • \$\begingroup\$ Can you link to an example of where this is done programmatically? I'm having a hard time imagining it. \$\endgroup\$
    – Brian
    Aug 9 '11 at 19:19
  • \$\begingroup\$ Here's an example of the relevant code in AS3 using Flixel from a current work-in-progress: pastebin.com/cvjt17Ku I can't guarantee that this code is elegant or readable. \$\endgroup\$ Aug 9 '11 at 21:46

The 2d Zelda games likely had a set of points (basically a rectangle) that contained the 'max scroll' limits on the camera, and when Link walked to a different room, it would move the camera and change where those points were set. If you've already got bounds on the camera, then you can likely add these sort of room transitions without too much work. During transitions, disable player input and quickly move the camera in the direction you want, then return control to the player.

Pointless extra trivia time: Link's Awakening (and likely the other 2d zelda games) contained only a few maps that contained many different rooms, along the overworld and caves and dungeons mixed together (there's examples of this out on the internet, but I can't seem to find them right now). I believe Link's Awakening in particular had 3 maps total, and many transitions would simply warp you to a different spot on the same map.


This is easy. The most obvious logic would be:

  • Calculate camera viewport bounds and convert them to the world coordinates with current camera translation.
  • Check resulting "camera bounding rectangle" with bounds of the current room and forbid further camera movement if needed.
  • When your game charater moves onto a door trigger move camera to the next room.

The real question is, do you really want to break player's game flow after each room? This day and age there are lots of memory, and it's possible to avoid such form of a loading screen which slows down and irritates a player. Rarely a game can incorporate loading transitions into its atmosphere, like doors in the Resident Evil or Parasite Eve, end even then it's a mild annoyance.

I can't see your game world, but maybe other techniques which wont require waiting for a transition to end can be used, like fog of war, room roofs, vague silhouettes or some other form of "terra incognita"?

  • 2
    \$\begingroup\$ I'd argue that the '2d zelda transition' is almost a convention of the genre at this point (see also: Metroid's doors). If the transitions are fast, and done well, it really shouldn't be a problem. It can actually be useful in some cases, telling the player "there are puzzles/enemies that reset when you go through the transition" You definitely want to have multi-screen rooms though. \$\endgroup\$
    – thedaian
    Aug 5 '11 at 21:59
  • 1
    \$\begingroup\$ Well, I would agree that transitions can be useful when rooms are placed in a logically impossible way, or when it's a requirement for a game to look like someone else's retro-style, which also emerged due to hardware limitations and not for a convenience of a player :) Maybe it's a pet peeve, but I always disliked transitions. \$\endgroup\$
    – EnoughTea
    Aug 5 '11 at 23:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .