Only keeping the view inside the room horizontally

Discussion in 'Legacy GameMaker Community Tech Support' started by xery555, Aug 28, 2019.

  1. xery555

    xery555 Member

    Dec 26, 2016

    I have a problem with the view function in Game Maker. I want the view to not go outside the room horizontally, but ignore the room height. It should follow the player.

    So I have this code:
    view_xview[0] = x - (view_wview[0]/2);
    view_yview[0] = y - (view_hview[0]/2);
    But that makes the view go outside the room freely from all sides.

    Then I have his code:
    view_hborder[0] = view_wview[0] / 2;
    view_vborder[0] = view_hview[0] / 2;
    But that makes the view not go outside the room at all.

    So I guess the solution is a mix of these two, but I have no idea how to do it.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice