| 1234567891011121314151617181920212223242526 |
- if instance_exists(follow)
- {
- x_to = follow.x;
- y_to = follow.y;
- }
- else
- {
- x_to = RES_W / 2;
- y_to = RES_H / 2;
- }
- shake_magnitude = lerp(shake_magnitude, 0, 0.05);
- if shake_magnitude < 1
- shake_magnitude = 0;
-
- var _x_delta = random_range(-shake_magnitude, shake_magnitude);
- var _y_delta = random_range(-shake_magnitude, shake_magnitude);
- var _target_x = clamp(x_to, bound_left + cam_width / 2, bound_right - cam_width / 2);
- x += (_target_x - x) * smooth * global.time_scale + _x_delta;
- var _target_y = clamp(y_to, bound_top + cam_height / 2, bound_bottom - cam_height / 2);
- y += (_target_y - y) * smooth * global.time_scale + _y_delta;
- var _cam_x = x - cam_width / 2;
- var _cam_y = y - cam_height / 2;
- camera_set_view_pos(view_camera[0], _cam_x, _cam_y);
|