• 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!

Camera and view in (GMS1)

B

Bip

Guest
How do I get the camera to follow the player? I've already set up the views, but when the character goes out of it, she doesn't follow him (GMS1)
 

Rob

Member
in the step event of your player, you want this code:

GML:
//Make the view follow the camera

//The view is drawn from the top left and we want to have the player in the center
//So the top left of the view wants to be HALF of the view width/height away from the
//player
view_xview[0] = x - (view_wview[0] / 2);
view_yview[0] = y - (view_hview[0] / 2);
I think that should work, its been a while since I used 1.4

Setting up the views in gamemaker won't make the view follow the player, you have to tell the view to do it. You can use the built in "Follow Object..." in the view settings but... I don't recommend it due to the stuttering you can get sometimes
 
Top