• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

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

Z

ZaHee

Guest
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)
 
Top