Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_flowey_world_camera_2_Step_2

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (!instance_exists(obj_pl))
4
    return;
5
if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[0], y_min[0], x_max[0], y_max[0])
6
    current_area = 0
7
else if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[1], y_min[1], x_max[1], y_max[1])
8
    current_area = 1
9
else if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[2], y_min[2], x_max[2], y_max[2])
10
    current_area = 2
11
else if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[3], y_min[3], x_max[3], y_max[3])
12
    current_area = 3
13
else if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[4], y_min[4], x_max[4], y_max[4])
14
    current_area = 4
15
else if point_in_rectangle(obj_pl.x, obj_pl.y, x_min[5], y_min[5], x_max[5], y_max[5])
16
    current_area = 5
17
var cam_x = obj_pl.x - cam_width_half + x_offset
18
var cam_y = obj_pl.y + 30 - cam_height_half
19
var cam_x_min = x_min[current_area] - 60
20
var cam_y_min = y_min[current_area] - 35
21
var cam_x_max = x_max[current_area] - 120 - 160
22
var cam_y_max = y_max[current_area] + 95
23
if (current_area == 0)
24
{
25
    cam_x_min = x_min[current_area]
26
    cam_y_min = y_min[current_area]
27
    cam_x_max = x_max[current_area]
28
    cam_y_max = y_max[current_area]
29
}
30
else if (current_area == 1)
31
{
32
    camera_set_view_pos(view_camera[0], 320, 0)
33
    return;
34
}
35
camera_set_view_pos(view_camera[0], clamp(cam_x, cam_x_min, cam_x_max), clamp(cam_y, cam_y_min, cam_y_max))