Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_circlezoom_Step_2

(view raw script w/o annotations or w/e)
1
if (type == 0)
2
{
3
    siner++;
4
    x += (sin(siner / 8) / 2);
5
    y += (cos(siner / 8) / 2);
6
    zoomtimer += ((zoomtimer / 5) + 16);
7
    if (zoomtimer >= zoomtime)
8
        zoomtimer = zoomtime;
9
    lerpamount = zoomtimer / zoomtime;
10
    if (lerpamount >= 1)
11
        lerpamount = 1;
12
    radius = lerp(startradius, endradius, lerpamount);
13
}
14
if (type == 1)
15
{
16
    if (radius > endradius)
17
        radius -= 8;
18
    if (radius <= 0)
19
        radius = 0;
20
}
21
if (type == 2 || type == 3 || type == 4)
22
{
23
    depth = 100;
24
    siner++;
25
    if (type == 2)
26
    {
27
        radius = 40;
28
        x = 448 + (sin(siner / 8) / 2);
29
        y = 210 + (cos(siner / 8) / 2);
30
    }
31
    if (type == 3 || type == 4)
32
    {
33
        if (type == 3)
34
        {
35
            if (radius < 180)
36
                radius = lerp(radius, 180, 0.1);
37
        }
38
        if (type == 4)
39
        {
40
            radius += 10;
41
            if (radius > 290)
42
                instance_destroy();
43
        }
44
        var hold = (right_h() - left_h()) * (obj_mainchara.wspeed * 4);
45
        if (button2_h())
46
            hold *= 2;
47
        if (global.interact != 0)
48
            hold = 0;
49
        var targx = camerax() + 300;
50
        targx = obj_mainchara.x + 12 + hold;
51
        var targy = cameray() + 210 + (cos(siner / 8) / 2);
52
        targy = obj_mainchara.y;
53
        if (i_ex(obj_cutscene_master))
54
            targx = camerax() + 320;
55
        var overwrite = false;
56
        with (obj_camera_area)
57
        {
58
            if (place_meeting(x, y, obj_mainchara))
59
                overwrite = true;
60
        }
61
        if (overwrite)
62
        {
63
            targx = lerp(x, camerax() + 320, 0.5);
64
            targy = lerp(y, cameray() + 240, 0.5);
65
        }
66
        if (global.interact != 5)
67
        {
68
            if (abs(targx - x) > 6)
69
                x = lerp(x, targx, 0.1);
70
            if (abs(targy - y) > 6)
71
                y = lerp(y, targy, 0.1);
72
            y += (cos(siner / 8) / 2);
73
            x += (sin(siner / 8) / 2);
74
        }
75
        if (init == 0)
76
        {
77
            x = targx;
78
            y = targy;
79
            init = 1;
80
        }
81
    }
82
}
83
if (!surface_exists(surf))
84
    surf = surface_create(room_width, room_height);
85
surface_set_target(surf);
86
if (type == 3 || type == 4)
87
{
88
    var intensity = 1;
89
    if (room == room_dw_couch_overworld_intro)
90
        intensity = 1.5;
91
    if (room == room_dw_couch_overworld_01)
92
        intensity = 1.35;
93
    if (room == room_dw_couch_overworld_02 || room == room_dw_couch_points)
94
        intensity = 1.2;
95
    if (room == room_dw_couch_overworld_03)
96
        intensity = 0.7;
97
    if (room == room_dw_couch_overworld_04)
98
        intensity = 0.5;
99
    draw_set_alpha(0.4 * intensity);
100
    draw_set_color(c_black);
101
    draw_rectangle(0, 0, camerax() + 700, cameray() + 500, false);
102
    draw_set_blend_mode(bm_subtract);
103
    draw_set_color(c_white);
104
    draw_circle(x, y, radius, false);
105
    draw_circle(x, y, radius + 20, false);
106
    draw_circle(x, y, radius + 40, false);
107
    draw_set_alpha(1);
108
}
109
else
110
{
111
    draw_clear(c_black);
112
    draw_set_blend_mode(bm_subtract);
113
    draw_set_color(c_white);
114
    draw_circle(x, y, radius, false);
115
}
116
surface_reset_target();
117
draw_set_blend_mode(bm_normal);
118
if (finish == 1)
119
{
120
    type = 1;
121
    endradius = 0;
122
    zoomtime += 100;
123
}