Author Topic: zelda-style screens  (Read 1150 times)

bpercevic

  • Member
  • **
  • Posts: 87
  • Karma: +2/-0
    • View Profile
zelda-style screens
« on: Sun, Oct 9, 2011 »
just curious how you guys would do zelda-style screens, like where the camera follows only a specific zone, then when you reach the edge it either snaps to the new zone or freezes the game to scroll.

i wrote a function that updates the camera boundaries based on the players location, so its not very flexible.  basically i define what the screen size is, like 30x20 tiles and then calculate to see if the player is within a 30x20 section and snap the camera to that section.  the problem is that when my game world gets huge i have to make sure all sections are about the same size.

anyone have a really nice way to implement screens?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: zelda-style screens
« Reply #1 on: Sun, Oct 9, 2011 »
Personally I'd use a hidden tile in the tile map. A "snap" tile. So rather than the camera having to jump to say +30 tiles across, it can look for the closest snap tile (based on the direction the player is moving) and snap to that instead. Then it doesn't matter what size your areas are.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

bpercevic

  • Member
  • **
  • Posts: 87
  • Karma: +2/-0
    • View Profile
Re: zelda-style screens
« Reply #2 on: Sun, Oct 9, 2011 »
that would work nicely for indoors like dungeons.  how what about a larger over world?

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: zelda-style screens
« Reply #3 on: Mon, Oct 10, 2011 »
Well you pick a point in that world to transition them to. If the "room" size is > the camera then it's got to scroll around anyway, right? Until they hit the edge and force a new scroll. So no reason why you can't place a snap marker so it snaps to somewhere interesting within the map, and they walk around the rest of it.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius