A
Alex H
Guest
The camera puts my character at the most bottom-right corner of the screen, not the center. Any tips? Thanks. My code is:
cam = view_camera[0];
follow = obj_player;
view_w_half = camera_get_view_width(cam) + 0.5;
view_h_half = camera_get_view_height(cam) + 0.5;
xTo = xstart;
yTo = ystart;
if (instance_exists(follow))
{
xTo = follow.x;
yTo = follow.y;
}
x += (xTo - x) / 25;
y += (yTo - y) / 25;
camera_set_view_pos(cam,x - view_w_half,y - view_h_half);
cam = view_camera[0];
follow = obj_player;
view_w_half = camera_get_view_width(cam) + 0.5;
view_h_half = camera_get_view_height(cam) + 0.5;
xTo = xstart;
yTo = ystart;
if (instance_exists(follow))
{
xTo = follow.x;
yTo = follow.y;
}
x += (xTo - x) / 25;
y += (yTo - y) / 25;
camera_set_view_pos(cam,x - view_w_half,y - view_h_half);