Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_camera_controller_Step_2

(view raw script w/o annotations or w/e)
1
if (camcontrol)
2
{
3
    if (mode == 0)
4
    {
5
        obj_mainchara.cutscene = true;
6
        var wd = (obj_mainchara.x + 11) - 320;
7
        var ht = (obj_mainchara.y + 17) - 240;
8
        var resetval = true;
9
        with (obj_camera_clamper)
10
        {
11
            if (place_meeting(x, y, obj_mainchara))
12
            {
13
                resetval = false;
14
                other.xmin = xmin;
15
                other.ymin = ymin;
16
                other.xmax = xmax;
17
                other.ymax = ymax;
18
            }
19
        }
20
        if (resetval)
21
        {
22
            xmin = 0;
23
            ymin = 0;
24
            xmax = room_width - 320;
25
            ymax = room_height - 240;
26
        }
27
        if (!i_ex(obj_shake))
28
        {
29
            camerax_set(clamp(wd, xmin, xmax));
30
            cameray_set(clamp(ht, ymin, ymax));
31
        }
32
    }
33
    if (mode == 1)
34
    {
35
        obj_mainchara.cutscene = true;
36
        if (!i_ex(obj_shake))
37
        {
38
            camerax_set(clamp(round(xpos), xmin, xmax));
39
            cameray_set(clamp(round(ypos), ymin, ymax));
40
        }
41
    }
42
}