Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_b3bs_stealth_Step_2

(view raw script w/o annotations or w/e)
1
if (active && enabled)
2
{
3
    if (wasactive == false)
4
    {
5
        if (!kindaactive)
6
        {
7
            for (var i = 0; i < array_length(actualcat); i++)
8
            {
9
                if (i_ex(actualcat[i]))
10
                {
11
                    catmarker[i].visible = true;
12
                    actualcat[i].visible = false;
13
                    catmarker[i].x = actualcat[i].x;
14
                    catmarker[i].y = actualcat[i].y;
15
                }
16
            }
17
        }
18
        if (kindaactive == true)
19
            kindaactive = false;
20
        susie.visible = true;
21
        ralsei.visible = true;
22
        with (obj_caterpillarchara)
23
        {
24
            visible = false;
25
            if (name == "susie")
26
            {
27
                other.susie.x = x;
28
                other.susie.y = y;
29
            }
30
            if (name == "ralsei")
31
            {
32
                other.ralsei.x = x;
33
                other.ralsei.y = y;
34
            }
35
        }
36
        wasactive = true;
37
    }
38
    if (global.interact == 0)
39
    {
40
        if (right_h())
41
            dir = 0;
42
        if (left_h())
43
            dir = 1;
44
    }
45
    su_xoff = 12;
46
    su_yoff = -22;
47
    ra_xoff = -24;
48
    ra_yoff = -4;
49
    kris.fun = true;
50
    kris.canrun = false;
51
    kris.sprite_index = spr_krisd_dark_stealth;
52
    ralsei.sprite_index = spr_ralsei_d_stealth;
53
    susie.sprite_index = spr_susied_dark_stealth;
54
    for (var i = 0; i < 20; i++)
55
    {
56
        if (i_ex(catmarker[i]))
57
            catmarker[i].image_xscale = 2;
58
    }
59
    if (dir == 1)
60
    {
61
        su_xoff = -4;
62
        ra_xoff = 16;
63
        kris.sprite_index = spr_krisd_dark_stealth_left;
64
        ralsei.sprite_index = spr_ralsei_d_stealth_left;
65
        susie.sprite_index = spr_susied_dark_stealth_left;
66
        for (var i = 0; i < 20; i++)
67
        {
68
            if (i_ex(catmarker[i]))
69
                catmarker[i].image_xscale = -2;
70
        }
71
    }
72
    kris.runtimer = 0;
73
    stealthspeed = 16;
74
    if (room == room_dw_b3bs_zapper_a && global.flag[1184 sneaking_fast] == 0)
75
        stealthspeed = 2;
76
    if (room == room_dw_teevie_stealth_d && global.flag[1230 sneak_zapper_state] == 2)
77
        stealthspeed = 24;
78
    stealthtimer++;
79
    if (stealthtimer > 6)
80
        stealthtimer = 6;
81
    kris.bwspeed = max(2, (stealthspeed * stealthtimer) / 6);
82
    kris.wspeed = max(2, (stealthspeed * stealthtimer) / 6);
83
    lerpstrength = lerp(lerpstrength, 0.5, 0.2);
84
    if (global.interact == 0 || alert)
85
    {
86
        if (i_ex(susie) && i_ex(kris))
87
        {
88
            susie.x = lerp(susie.x, kris.x + su_xoff, lerpstrength);
89
            susie.y = lerp(susie.y, kris.y + su_yoff, lerpstrength * 1.5);
90
            with (susie)
91
                
scr_depth
scr_depth

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
92
        }
93
        if (i_ex(ralsei) && i_ex(susie))
94
        {
95
            ralsei.x = lerp(ralsei.x, susie.x + ra_xoff, lerpstrength);
96
            ralsei.y = lerp(ralsei.y, susie.y + ra_yoff, lerpstrength * 1.5);
97
            with (ralsei)
98
                
scr_depth
scr_depth

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
99
            ralsei.depth += 40;
100
        }
101
        for (var i = 0; i < array_length(actualcat); i++)
102
        {
103
            if (i_ex(actualcat[i]))
104
            {
105
                myxoff = 0;
106
                myyoff = 0;
107
                switch (i)
108
                {
109
                    case 1:
110
                        myxoff = -10;
111
                        myyoff = -2;
112
                        if (dir == 1)
113
                            myxoff = 50;
114
                        break;
115
                    case 2:
116
                        myxoff = -20;
117
                        myyoff = -30;
118
                        if (dir == 1)
119
                            myxoff = 60;
120
                        break;
121
                    case 3:
122
                        myxoff = 54;
123
                        myyoff = -42;
124
                        if (dir == 1)
125
                            myxoff = -14;
126
                        break;
127
                    case 4:
128
                        myxoff = 82;
129
                        myyoff = -2;
130
                        if (dir == 1)
131
                            myxoff = 50;
132
                        break;
133
                    case 5:
134
                        myxoff = -40;
135
                        myyoff = -64;
136
                        if (dir == 1)
137
                            myxoff = 80;
138
                        break;
139
                }
140
                catmarker[i].x = lerp(catmarker[i].x, ralsei.x + myxoff, lerpstrength);
141
                catmarker[i].y = (ralsei.y + myyoff) - abs(sin(catsiner[i] / 40) * 8);
142
                catmarker[i].depth = ralsei.depth + (i * 4);
143
            }
144
        }
145
        if (point_distance(krx, kry, kris.x, kris.y) > 1)
146
            kris.image_index += 0.125;
147
        if (point_distance(sux, suy, susie.x, susie.y) > 1)
148
            susie.image_index += 0.125;
149
        if (point_distance(rax, ray, ralsei.x, ralsei.y) > 1)
150
            ralsei.image_index += 0.125;
151
        if (point_distance(krx, kry, kris.x, kris.y) > 2)
152
            kris.image_index += 0.0625;
153
        if (point_distance(sux, suy, susie.x, susie.y) > 2)
154
            susie.image_index += 0.0625;
155
        if (point_distance(rax, ray, ralsei.x, ralsei.y) > 2)
156
            ralsei.image_index += 0.0625;
157
        for (var i = 0; i < 20; i++)
158
        {
159
            if (i_ex(catmarker[i]))
160
            {
161
                if (point_distance(catmarker[i].x, catmarker[i].y, genx[i], geny[i]) > 2)
162
                {
163
                    catmarker[i].image_index += 0.125;
164
                    if (i == 5)
165
                        catmarker[i].image_index += 0.125;
166
                    buff[i] = 6;
167
                }
168
                else
169
                {
170
                    buff[i]--;
171
                    if (buff[i] <= 0)
172
                        catmarker[i].image_index = 0;
173
                }
174
            }
175
        }
176
        krx = kris.x;
177
        kry = kris.y;
178
        rax = ralsei.x;
179
        ray = ralsei.y;
180
        sux = susie.x;
181
        suy = susie.y;
182
        for (var i = 0; i < 20; i++)
183
        {
184
            if (i_ex(catmarker[i]))
185
            {
186
                catsiner[i] += abs(genx[i] - catmarker[i].x);
187
                genx[i] = catmarker[i].x;
188
                geny[i] = catmarker[i].y;
189
            }
190
        }
191
        kris.mask_index = spr_krisd_dark;
192
        with (obj_caterpillarchara)
193
        {
194
            follow = false;
195
            if (name == "susie")
196
            {
197
                x = other.susie.x;
198
                y = other.susie.y;
199
            }
200
            if (name == "ralsei")
201
            {
202
                x = other.ralsei.x;
203
                y = other.ralsei.y;
204
            }
205
        }
206
    }
207
    with (kris)
208
    {
209
        if (!place_meeting(x, y, obj_b3bs_stealtharea))
210
            other.active = false;
211
    }
212
}
213
else
214
{
215
    if (wasactive == true)
216
    {
217
        wasactive = false;
218
        ralsei.visible = false;
219
        susie.visible = false;
220
        kris.fun = 0;
221
        kris.canrun = true;
222
        stealthtimer = 0;
223
        with (kris)
224
        {
225
            bwspeed = 4;
226
            wspeed = 4;
227
        }
228
        ralsei.x = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(ralsei.x);
229
        ralsei.y = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(ralsei.y);
230
        susie.x = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(susie.x);
231
        susie.y = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(susie.y);
232
        with (obj_caterpillarchara)
233
        {
234
            if (name == "susie")
235
            {
236
                x = other.susie.x;
237
                y = other.susie.y;
238
            }
239
            if (name == "ralsei")
240
            {
241
                x = other.ralsei.x;
242
                y = other.ralsei.y;
243
            }
244
            follow = true;
245
            
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate()
{ _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
246
            visible = true;
247
        }
248
        for (var i = 0; i < array_length(actualcat); i++)
249
        {
250
            if (i_ex(actualcat[i]))
251
            {
252
                catmarker[i].visible = false;
253
                actualcat[i].visible = true;
254
                switch (i)
255
                {
256
                    case 1:
257
                        myxoff = -10;
258
                        myyoff = -2;
259
                        if (dir == 1)
260
                            myxoff = 50;
261
                        break;
262
                    case 2:
263
                        myxoff = -20;
264
                        myyoff = -30;
265
                        if (dir == 1)
266
                            myxoff = 60;
267
                        break;
268
                    case 3:
269
                        myxoff = 54;
270
                        myyoff = -42;
271
                        if (dir == 1)
272
                            myxoff = -14;
273
                        break;
274
                    case 4:
275
                        myxoff = 82;
276
                        myyoff = -2;
277
                        if (dir == 1)
278
                            myxoff = 50;
279
                        break;
280
                    case 5:
281
                        myxoff = -40;
282
                        myyoff = -64;
283
                        if (dir == 1)
284
                            myxoff = 80;
285
                        break;
286
                }
287
                actualcat[i].x = ralsei.x + myxoff;
288
                actualcat[i].y = ralsei.y + myyoff;
289
                actualcat[i].interpolate = true;
290
            }
291
        }
292
    }
293
    lerpstrength = lerp(lerpstrength, 0.1, 0.1);
294
    with (kris)
295
    {
296
        if (place_meeting(x, y, obj_b3bs_stealtharea))
297
            other.active = true;
298
    }
299
}
300
if (alert == 1)
301
{
302
    alerttimer++;
303
    if (alerttimer == 1)
304
    {
305
        enabled = true;
306
        with (susie)
307
            setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(x),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(y));
308
        with (ralsei)
309
            setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(x),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(y));
310
        with (obj_mainchara)
311
            setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(x),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(y));
312
        with (obj_caterpillarchara)
313
            setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(x),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(y));
314
        var centeredx = alerter.x + ((sprite_get_width(alerter.sprite_index) * alerter.image_xscale) / 2);
315
        var centeredy = alerter.bbox_bottom + 20;
316
        var lightxoff = -42;
317
        var lightyoff = 0;
318
        with (alertlight)
319
        {
320
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, obj_mainchara.x + lightxoff, 16, -1, "out");
321
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, obj_mainchara.y + 60 + lightyoff, 16, -1, "out");
322
        }
323
    }
324
    if (alerttimer == 16)
325
    {
326
        alerttimer = 0;
327
        alert = 2;
328
    }
329
}
330
ralsei.image_alpha = 1;
331
susie.image_alpha = 1;
332
kris.image_alpha = 1;