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

Help with camera in game maker studio 2

southyokkai

Member
So, basically I'm having trouble creating a megaman style camera, all I managed to do is to get it to follow my character. I tried to follow this video which was exactly what I wanted, but then I saw that it was done in Studio 1 so I tried to translate it to Studio 2, but it ended up in errors that I don't even know how to explain.

I made the same things he did in the video, except for the codes.

my video

and my code
GML:
///create event in the player object

view_xmin = 0;
view_xmax = 512;
view_ymin = 0;
view_ymax = 288;

///step event in the player object

if !view_enabled {
    view_visible[0] = true;
    view_enabled = true;
}

view_xport[0]=x-256;
view_yport[0]=y-144;
view_wport[0]=512;
view_hport[0]=288;

if place_meeting(x,y,oRoom) {
    with(instance_position(x,y,oRoom)) {
        other.view_xmin = x;
        other.view_xmax = x+(512*image_xscale);
        other.view_ymin = y;
        other.view_ymax = y+(288*image_yscale);
    }
    
    if view_xport[0] < view_xmin view_xport[0] = view_xmin;
    if view_yport[0] < view_ymin view_yport[0] = view_ymin;
    
    if view_xport[0]+512 > view_xmax view_xport[0] = view_xmax-512;
    if view_yport[0]+288 > view_ymax view_yport[0] = view_ymax-288;
    
}
Help me please.
Thanks in advance.
 
Top