Is it possible to restrict the viewport?

Get help using Construct 2

Post » Sun Jan 13, 2013 3:13 pm

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
B
3
Posts: 4
Reputation: 733

Post » Sun Jan 13, 2013 4:13 pm

What you are looking for is layers, enjoy! :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun Jan 13, 2013 8:25 pm

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.
B
3
Posts: 4
Reputation: 733

Post » Sun Jan 13, 2013 8:37 pm

[QUOTE=Khoram] 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.[/QUOTE]

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?
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun Jan 13, 2013 8:49 pm

OK sorry I am not being clear. Maybe this picture will help?



B
3
Posts: 4
Reputation: 733

Post » Sun Jan 13, 2013 10:03 pm

Something like this maybe? restrictedViewport.capx (r115) (doesn't take scaling into account).
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Sun Jan 13, 2013 10:12 pm

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!
B
3
Posts: 4
Reputation: 733


Return to How do I....?

Who is online

Users browsing this forum: Paradox, Yahoo [Bot] and 2 guests