| 12345678910111213141516171819202122 |
- if instance_exists(follow)
- {
- x_to = follow.x;
- y_to = follow.y;
- }
- 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);
- x += (x_to - x) * smooth * global.time_scale + _x_delta;
- y += (y_to - y) * smooth * global.time_scale + _y_delta;
- x = clamp(x, cam_width / 2, room_width - cam_width / 2) + _x_delta;
- y = clamp(y, cam_height / 2, room_height - cam_height / 2) + _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);
|