How do I make camera follow hero in Zelda GB-style?

  • I'm trying to make a gameboy-style Zelda dungeon. It's a top-down, 8-directional movement sword and sorcery adventure.

    I want this effect (it's complex to explain, so bear with me):

    The camera should center on the hero as long as the camera window is not touching a wall. When the camera window is touching the wall, the hero moves around within that window space until the hero pulls away from the wall enough to center the hero back in that camera window.

    VIDEO EXAMPLE: [https://www.youtube.com/watch?v=cec7dyk0Khw]

    See how the room is bigger than the window size, but the window is bound to the edge of the room? That is what I want. In other words, I want the window bound to the edges of the rooms, but I want the hero to be bound to the window, and I want the window to center on the hero unless the window is bound by the room.

    Please know that I do not want to have a separate layout for every room within a dungeon.

    Any advice?

  • Make a sprite called zone. That will be your "camera zone". Overlay every room with it, separetely. So you clone it (CTRL + drag)

    Something like this

    Then, use this event. The settings (400 and 256) depend on the size of your layout. Put half and half in each.

    Make a layer intended for the zones, it'll make it easier to map and you'll be able to lock them.

    I got this from a capx I found around the forums.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yep, that's the one. Thanks zatyka!

  • Thanks, guys. Very helpful!

  • very helpful, thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)