Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_saucer_monty_Step_0

(view raw script w/o annotations or w/e)
1
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
2
if (con == 0 && myinteract == 1)
3
{
4
    global.interact = 1;
5
    myinteract = 0;
6
    con = 1;
7
    visible = 0;
8
    if (i_ex(collider))
9
        instance_destroy(collider);
10
    if (room == room_dw_mansion_east_2f_a)
11
    {
12
        with (obj_ch2_room_mansion_east_2f_a)
13
        {
14
            if (forcefield == -4)
15
                make_forcefield = true;
16
        }
17
    }
18
    if (room == room_dw_mansion_east_2f_shortcut)
19
    {
20
        with (obj_ch2_room_mansion_2f_shortcut)
21
        {
22
            if (forcefield == -4)
23
                make_forcefield = true;
24
        }
25
    }
26
}
27
if (con == 1)
28
{
29
    if (boss == 1)
30
        snd_play(snd_spearappear);
31
    radius = 0;
32
    keysaucer = floor(random(saucercount));
33
    for (i = 0; i < saucercount; i += 1)
34
    {
35
        saucer[i] = instance_create(x, y, obj_saucer);
36
        saucer[i].montyboss = 2;
37
        saucer[i].image_alpha = 0.7;
38
        saucer[i].mode = 1;
39
        if (i == keysaucer)
40
        {
41
            saucer[i].content = 3;
42
            saucer[i].contentsprite = spr_ch2_gimmick_saucer_key;
43
        }
44
        else
45
        {
46
            saucer[i].content = 2;
47
            saucer[i].contentsprite = spr_ch2_gimmick_saucer_bomb;
48
        }
49
        saucerangle[i] = 90 + ((360 / saucercount) * i);
50
    }
51
    saucer[0].montyboss = 1;
52
    con = 2;
53
}
54
if (con == 2)
55
{
56
    radius += 2;
57
    for (i = 0; i < saucercount; i += 1)
58
    {
59
        saucer[i].x = x + lengthdir_x(radius, saucerangle[i]);
60
        saucer[i].y = y + lengthdir_y(radius, saucerangle[i]);
61
    }
62
    obj_mainchara.x = lerp(obj_mainchara.x, (x + 50) - 19, radius / 200);
63
    obj_mainchara.y = lerp(obj_mainchara.y, (y + 40) - 38, radius / 200);
64
    if (radius >= 100)
65
    {
66
        con = 3;
67
        for (i = 0; i < saucercount; i += 1)
68
            saucer[i].image_alpha = 1;
69
        timer = 0;
70
    }
71
}
72
if (con == 3)
73
{
74
    timer += (1 * multiplier);
75
    if (timer == 30)
76
    {
77
        for (i = 0; i < saucercount; i += 1)
78
        {
79
            with (saucer[i])
80
                myinteract = 1;
81
        }
82
    }
83
    if (timer >= 100)
84
    {
85
        if (boss == 1)
86
            loop = snd_loop(snd_chain_wave);
87
        con = 4;
88
        timer = 0;
89
        maxsiner = 960 + ((floor(random(6)) * saucercount) / 360);
90
        siner = 0;
91
        sinerspeed = 1;
92
    }
93
}
94
if (con == 4)
95
{
96
    if (boss == 1)
97
        snd_pitch(loop, (sin(siner / 8) * 0.5) + 1);
98
    siner += (sinerspeed * multiplier);
99
    if (siner <= (maxsiner - 90))
100
    {
101
        if (sinerspeed <= 10)
102
            sinerspeed += (0.25 * multiplier);
103
    }
104
    if (siner >= (maxsiner - 90))
105
    {
106
        if (sinerspeed >= 5)
107
            sinerspeed -= (0.5 * multiplier);
108
    }
109
    if (siner >= maxsiner)
110
    {
111
        siner = maxsiner;
112
        con = 5;
113
        if (boss == 1)
114
            snd_stop(loop);
115
        with (obj_mainchara)
116
            global.interact = 0;
117
        for (i = 0; i < saucercount; i += 1)
118
            saucer[i].mode = 3;
119
        with (obj_saucer)
120
        {
121
            collider.x = x + 8;
122
            collider.y = y + 22;
123
        }
124
    }
125
    for (i = 0; i < saucercount; i += 1)
126
    {
127
        saucer[i].x = x + lengthdir_x(radius, saucerangle[i] + siner);
128
        saucer[i].y = y + lengthdir_y(radius, saucerangle[i] + siner);
129
    }
130
}
131
if (con == 6)
132
{
133
    obj_mainchara.battlemode = 1;
134
    if (i_ex(saucer[0]))
135
        timer = 0;
136
    if (!i_ex(saucer[0]))
137
    {
138
        timer += (1 * multiplier);
139
        if (timer >= 120)
140
            obj_mainchara.battlemode = 0;
141
        if (timer >= 150)
142
        {
143
            krischeck = collision_rectangle(bbox_left - 6, bbox_top - 6, bbox_right + 6, bbox_bottom + 6, obj_mainchara, true, false);
144
            if (!place_meeting(x, y, obj_mainchara))
145
            {
146
                shadow = instance_create(x, y, obj_marker);
147
                shadow.sprite_index = sprite_index;
148
                shadow.image_index = 0;
149
                shadow.image_speed = 0;
150
                shadow.image_xscale = 2;
151
                shadow.image_yscale = 2;
152
                shadow.image_blend = c_black;
153
                shadow.depth = 900000;
154
                fakeblock = instance_create(x, y, obj_soliddark);
155
                fakeblock.sprite_index = sprite_index;
156
                fakeblock.image_index = 0;
157
                fakeblock.image_speed = 0;
158
                fakeblock.image_xscale = 2;
159
                fakeblock.image_yscale = 2;
160
                fakeblock.image_blend = c_red;
161
                fakeblock.depth = 900000;
162
                fakeme = instance_create(x, -100, obj_marker);
163
                fakeme.sprite_index = sprite_index;
164
                fakeme.image_index = 0;
165
                fakeme.image_speed = 0;
166
                fakeme.image_xscale = 2;
167
                fakeme.image_yscale = 2;
168
                fakeme.gravity = 1;
169
                con = 7;
170
            }
171
        }
172
    }
173
}
174
if (con == 7)
175
{
176
    if (fakeme.y >= (y - 15))
177
    {
178
        with (fakeme)
179
            instance_destroy();
180
        with (shadow)
181
            instance_destroy();
182
        with (fakeblock)
183
            instance_destroy();
184
        visible = 1;
185
        con = 0;
186
        timer = 0;
187
        myinteract = 0;
188
        collider = instance_create(x + 8, y + 22, obj_solidblock);
189
        collider.image_xscale = 4.2;
190
        collider.image_yscale = 3;
191
    }
192
}