Is it possible to restrict the viewport?

  • Hi all,

    just getting started with Construct 2, and have looked at dozens of examples and not sure I've seen the following issue tackled. If I have overlooked an example or tutorial please let me know which one.

    I'm currently prototyping my game and have it scrolling to follow the player and it's working fine. However I want to add some GUI elements to the edges. Is it possible to restrict the viewport where the player is and the part that scrolls to a specific subsection of the screen?

    Thanks,

    Khoram

  • What you are looking for is layers, enjoy! :)

  • Oh well yes I know about layers. However, if I put a GUI layer over the main scrolling background, it doesn't restrict the scrollable/movable area, and it is possible for things to move underneath of the GUI where they can't be seen. I was wondering if there was a way to restrict that built into Construct.

    I am thinking I would have to add enough solid border around the edge to keep the player sprites from being able to move under the GUI. That might do the trick instead.

  • Oh well yes I know about layers. However, if I put a GUI layer over the main scrolling background, it doesn't restrict the scrollable/movable area, and it is possible for things to move underneath of the GUI where they can't be seen. I was wondering if there was a way to restrict that built into Construct.

    I am thinking I would have to add enough solid border around the edge to keep the player sprites from being able to move under the GUI. That might do the trick instead.

    I still don't quite get what you are trying to achieve here, you don't want stuff to be hidden under GUI layer? Can you perhaps post a picture or something that might clear up what you wish to happen and what not?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK sorry I am not being clear. Maybe this picture will help?

    <img src="https://dl.dropbox.com/u/2815946/example.png" border="0" />

  • Something like this maybe? restrictedViewport.capx (r115) (doesn't take scaling into account).

  • Ah yes, that's it, thank you! So instead of using the default ScrollTo behavior, you have to code your own that clamps movement to the area outside the GUI elements. Thanks again!

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