Step_0.gml 350 B

123456789101112131415
  1. if instance_exists(follow)
  2. {
  3. x_to = follow.x;
  4. y_to = follow.y;
  5. }
  6. x += (x_to - x) * smooth;
  7. y += (y_to - y) * smooth;
  8. x = clamp(x, cam_width/2, room_width - cam_width/2);
  9. y = clamp(y, cam_height/2, room_height - cam_height/2);
  10. var _cam_x = x - cam_width/2;
  11. var _cam_y = y - cam_height/2;
  12. camera_set_view_pos(view_camera[0], _cam_x, _cam_y);