T
tomoebi
Guest
Hi there.
So, i have problem with my camera movement.
I want my camera to not reset it position when i re-entering a room. As you can see it below
When i enter the second room and go back to the first room, you can see that my camera reset it position for a second. I want my camera to stay in its last coordinate when i changing room.
This is the code that i use
You probably already saw this code before, because i take it from Spalding. So far, the only code that i write on my own is the portal/door script. I have very little knowledge and experience with coding, so i would love to hear a noob-friendly explanation. Btw, if i ever finish this game i will credit you if you have the answer for my problem. Hahaaa
Thanks in advance.
So, i have problem with my camera movement.
I want my camera to not reset it position when i re-entering a room. As you can see it below
When i enter the second room and go back to the first room, you can see that my camera reset it position for a second. I want my camera to stay in its last coordinate when i changing room.
This is the code that i use
Code:
if (instance_exists(follow))
{
xTo = follow.x;
yTo = follow.y;
}
//Update object position
x += (xTo - x) / 12;
y += (yTo - y) / 12;
x = clamp(x,view_w_half,room_width-view_w_half);
y = clamp(y,view_h_half,room_height-view_h_half);
//Update camera view
camera_set_view_pos(cam,x-view_w_half,y-view_h_half);
///This is under create
cam = view_camera[0]
follow = MC;
view_w_half = camera_get_view_width(cam) * 0.5;
view_h_half = camera_get_view_height(cam) * 0.5;
xTo = xstart;
yTo = ystart;
Thanks in advance.