1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GML [SOLVED] How to make the camera move whenever an object leaves the camera viewport?

Discussion in 'Programming' started by ZaHee, Dec 1, 2019.

Tags:
  1. ZaHee

    ZaHee Member

    Joined:
    Dec 1, 2019
    Posts:
    2
    In the game I Wanna Be The Guy, whenever you leave the screen, the camera instantly moves to the next screen. Here's a video as an example. (the best example is at 5:03)

    What I'm trying to do is making it to whenever the player leaves the screen, the camera instantly shifts so that the next part of the room is showing, instead of having to make a new room for each screen.

    I tried searching on the Internet for how to do that, but the only things I found were how to make the camera follow the player.

    Does anyone know how to do this? Also, I'm using the Game Maker programming language, not drag and drop.

    CODE:
    //camera create event
    cam = view_camera[0];
    view_width = camera_get_view_width(cam);
    view_x = camera_get_view_x(cam);


    //camera step event
    if(Player.x > view_x + view_width) view_x += view_width;


    (if there's a special code block you can use when creating threads on this website, please tell me. I'm new to these forums)
     
  2. ZaHee

    ZaHee Member

    Joined:
    Dec 1, 2019
    Posts:
    2

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