SOLVED View in a view - scroll boundaries

oldnoob

Member
Hello there,

I hope I can explain this so it makes sense.

In short: how do I make a room stop scrolling and my player walk to the edge of the screen?

I have a large room in which I intend to create a scrolling platformer. I hope to have two Viewports - Viewport 0 will be the whole game window including a border and GUI, and a smaller Viewport 1 as the actual scrolling play area contained within Viewport 0.

Viewport 0 is located in an area of the room the player can't access.

When my player nears the boundary of the left side of the room, the scrolling stops and the player walks the rest of the way to the edge of the room. this happens on each edge of the screen as it should. However, the far right of my room, the player is not allowed to go beyond pixel 1400, but beyond this is the layout for Viewport 0, so the scrolling and the player stop at the same time.

I'm not sure I've explained this adequately, so I hope this GIF shows what I mean.
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
You'd have to take manual control over scrolling and directly manipulate the camera view's variables, using camera_create_view to create it and then positioning it via camera_set_view_pos. This gives you the option to set certain minimum and maximum positions to keep the visible area contained within the portion of the screen you want it to be in.

That sounds a bit more complicated than it needs to be, though. I don't think you really need two cameras to accomplish this.


What I'd suggest doing is to have a single camera, do away with the "whole game window including a border and GUI" part, and instead drawing that via the Draw GUI event, as that's what it's meant to be used for.
 
Top