Step_0.gml 672 B

12345678910111213141516171819202122
  1. if instance_exists(follow)
  2. {
  3. x_to = follow.x;
  4. y_to = follow.y;
  5. }
  6. shake_magnitude = lerp(shake_magnitude, 0, 0.05);
  7. if shake_magnitude < 1
  8. shake_magnitude = 0;
  9. var _x_delta = random_range(-shake_magnitude, shake_magnitude);
  10. var _y_delta = random_range(-shake_magnitude, shake_magnitude);
  11. x += (x_to - x) * smooth * global.time_scale + _x_delta;
  12. y += (y_to - y) * smooth * global.time_scale + _y_delta;
  13. x = clamp(x, cam_width / 2, room_width - cam_width / 2) + _x_delta;
  14. y = clamp(y, cam_height / 2, room_height - cam_height / 2) + _y_delta;
  15. var _cam_x = x - cam_width / 2;
  16. var _cam_y = y - cam_height / 2;
  17. camera_set_view_pos(view_camera[0], _cam_x, _cam_y);