Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_plat_enm_sethglasses_miniboss_Step_0

related scripts: CleanUp_0Collision_obj_plat_enm_smallgloveCollision_obj_plat_susieaxe_hbxCreate_0Draw_0Other_20PreCreate_0Step_0 Step_2

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_plat_player))
2
    
scr_flower_despwn
scr_flower_despwn

function
scr_flower_despwn(arg0 = 0)
{ arg0 = 0; hit = 0; with (instance_create_depth(x, y, depth, obj_plat_vfx)) { sprite_index = spr_smokepuff; image_speed = 2; } with (instance_create_depth(x, y, 2450, obj_flower_despwn, { image_blend: petal_color })) colored = true; var _spawner = instance_create_depth(x_home, y_home, 2450, obj_flower_spawner, { image_blend: petal_color }); _spawner._memory = {}; _spawner.image_xscale = image_xscale; _spawner.scale = sign(image_xscale); _spawner.was_onscreen = true; _spawner.colored = true; _spawner.image_yscale = image_yscale; _spawner.image_angle = image_angle; _spawner.obj_index = object_index; _spawner.activate = activate; _spawner.enemy_wave = enemy_wave; var array = __vars; for (var i = 0; i < array_length(array); i++) variable_struct_set(_spawner._memory, array[i], variable_instance_get(id, array[i])); with (_spawner) { obj_index = other.object_index; hp = other.hp; } if (arg0 == 0) { instance_destroy(); } else { } exit; }
(1);
3
if (con < 0)
4
    exit;
5
if (!global.pause_plat)
6
{
7
    if (hit > 0)
8
        hit--;
9
    if (shake > 0)
10
        shake--;
11
}
12
if (!_hp_init)
13
{
14
    _hp_init = true;
15
    __max_hp = hp;
16
}
17
if (!init)
18
{
19
    talkcon = 0;
20
    init = 1;
21
}
22
scr_plat_depthcast();
23
ral_hook_left.depth = depth - 1;
24
ral_hook_right.depth = depth - 1;
25
plat.x = (x + 12) - (0.5 * sprite_width);
26
plat.y = y - (0.5 * sprite_height);
27
su_act.active = con != 99;
28
if (auraalph > 0)
29
    su_act.blocked = 2;
30
else
31
    su_act.blocked = bullet_pattern_endstate != 0;
32
if (!global.pause_plat)
33
{
34
    if (is_stunned)
35
    {
36
        stun_timer++;
37
        su_act.blocked = true;
38
        shake = 5;
39
        if ((stun_timer % 2) == 1)
40
            
scr_plat_create_stunspark
scr_plat_create_stunspark

function
scr_plat_create_stunspark()
{ var spark = instance_create(random_range(bbox_left, bbox_right), random_range(bbox_top, bbox_bottom), obj_marker); with (spark) { sprite_index = spr_plat_rudebuster_sparks; image_speed = 0; depth = other.depth - 1; image_index = irandom_range(0, 3); image_angle = random_range(0, 360);
scr_shakeobj();
scr_doom(self, 2);
} }
();
41
        if (stun_timer >= stun_duration)
42
        {
43
            is_stunned = false;
44
            stun_timer = 0;
45
            shake = 0;
46
            su_act.blocked = su_act_blocked_pre_stun;
47
            on_stun_recover();
48
        }
49
    }
50
    if (bullet_pattern_can_expire)
51
    {
52
        bullet_pattern_expire_timer++;
53
        if (con > 1)
54
            bullet_pattern_expire_timer = min(bullet_pattern_expire_timer, 5910);
55
        if (rude_buster_use_cooldown > 0)
56
        {
57
            rude_buster_use_cooldown--;
58
            if (rude_buster_use_cooldown == 0)
59
            {
60
                talkcon = 13;
61
                event_user(10);
62
            }
63
        }
64
        if (bullet_pattern_dialogue_state == 0)
65
        {
66
            if (bullet_pattern_expire_timer == 300)
67
            {
68
                talkcon = 1;
69
                event_user(10);
70
            }
71
            if (bullet_pattern_expire_timer == 600)
72
            {
73
                talkcon = 2;
74
                event_user(10);
75
            }
76
            if (bullet_pattern_expire_timer == 900)
77
            {
78
                talkcon = 3;
79
                event_user(10);
80
            }
81
            if (bullet_pattern_expire_timer == 1200)
82
            {
83
                talkcon = 4;
84
                event_user(10);
85
            }
86
            if (bullet_pattern_expire_timer == 1500)
87
            {
88
                talkcon = 5;
89
                event_user(10);
90
            }
91
            if (bullet_pattern_expire_timer == 2400)
92
            {
93
                talkcon = 6;
94
                event_user(10);
95
            }
96
            if (bullet_pattern_expire_timer == 3300)
97
            {
98
                talkcon = 7;
99
                event_user(10);
100
            }
101
            if (bullet_pattern_expire_timer == 4200)
102
            {
103
                talkcon = 8;
104
                event_user(10);
105
            }
106
        }
107
        if (bullet_pattern_expire_timer == 6000)
108
        {
109
            with (obj_dw_cliff_seth_miniboss)
110
                bullet_pattern_die_expire(other);
111
            snd_play(snd_spearappear_choppy);
112
            animate(anim_expire);
113
        }
114
    }
115
    bullet_pattern_multipurpose_timer++;
116
    if (bullet_pattern_dialogue_state == 2 && bullet_pattern_multipurpose_timer == 300)
117
    {
118
        if (talkcon == 15)
119
        {
120
            talkcon = 16;
121
            event_user(10);
122
        }
123
    }
124
    hit--;
125
    lefthit--;
126
    righthit--;
127
    left_lens_opacity = max(left_lens_opacity - 0.05, 0.1);
128
    right_lens_opacity = max(right_lens_opacity - 0.05, 0.1);
129
    if (bullet_pattern_can_expire && con == 0)
130
    {
131
        if (lefthp > 20 || (lefthp < 20 && lefthp > 11))
132
        {
133
            if ((bullet_pattern_expire_timer % 450) == 0)
134
                lefthp--;
135
        }
136
        if (righthp > 20 || (righthp < 20 && righthp > 11))
137
        {
138
            if ((bullet_pattern_expire_timer % 450) == 0)
139
                righthp--;
140
        }
141
    }
142
    if (con == 1 || con == 4)
143
        plat.mask_index = -1;
144
    else
145
        plat.mask_index = spr_plat_blankmask;
146
    recovertimer++;
147
    timer += 1;
148
    var tt = 22;
149
    if (hp < 40)
150
        tt = 19;
151
    if (con >= 2)
152
        tt += 12;
153
    if (simple)
154
        tt = floor(lerp(7, 14, clamp01(hp / __max_hp)));
155
    if (con == 10 || con == 11 || con == 12)
156
        tt = 999999;
157
    else
158
        lerptimer += 0.1;
159
    if ((timer % tt) == 0 && con < 20 && bullet_pattern_endstate == 0)
160
        create_bullet();
161
    if (current_animation != -4 && anim_phase >= 0)
162
    {
163
        do_anim_step(current_animation);
164
    }
165
    else
166
    {
167
        movetimer++;
168
        if (con < 2)
169
        {
170
            eligible_for_standing_ending = false;
171
            if (con != 1)
172
                x = lerp(x, xstart + (sin(movetimer / 30) * 80), 0.05);
173
            conreturntimer = 0;
174
            if (con == 1 && !is_stunned)
175
            {
176
                con = 1.1;
177
                animate(anim_recover_end);
178
                if (bullet_pattern_dialogue_state == 1 && talkcon == 10)
179
                {
180
                    talkcon = 11;
181
                    event_user(10);
182
                }
183
                else if (bullet_pattern_dialogue_state == 1 && (talkcon == 11 || talkcon == 13))
184
                {
185
                    talkcon = 12;
186
                    event_user(10);
187
                }
188
            }
189
        }
190
        if (con == 2)
191
        {
192
            if (conreturntimer < 50)
193
            {
194
                conreturntimer += 1;
195
                if (
scr_plat_standing_on
scr_plat_standing_on

function
scr_plat_standing_on(arg0, arg1)
{ if (is_string(arg0)) { if (arg0 == "kr" || arg0 == "kris") { with (obj_plat_player) return grounded && ground == arg1; } else { with (obj_plat_follower) { if ((arg0 == "su" || arg0 == "susie") && name == "susie") return grounded && ground == arg1; if ((arg0 == "ra" || arg0 == "ralsei") && name == "ralsei") return grounded && ground == arg1; } } } else if (variable_instance_exists(arg0, "ground")) { return arg0.grounded && arg0.ground == arg1; } }
("kr", obj_dw_cliff_seth_miniboss.plat_ralsei.platform))
196
                {
197
                    stood_on_ralsei = true;
198
                    recovertimer = 0;
199
                }
200
                if (conreturntimer == 30)
201
                {
202
                    if (bullet_pattern_dialogue_state == 1)
203
                    {
204
                        bullet_pattern_dialogue_state = 2;
205
                        bullet_pattern_multipurpose_timer = 0;
206
                        talkcon = 15;
207
                        event_user(10);
208
                    }
209
                }
210
            }
211
            if (conreturntimer >= 90 && bullet_pattern_endstate == 0)
212
            {
213
                animate(anim_recover);
214
                con = 2.1;
215
            }
216
        }
217
        if (con == 4)
218
        {
219
            x = lerp(x, xstart + (sin(movetimer / 30) * 80), 0.05);
220
            conreturntimer = 0;
221
            if (
scr_plat_standing_on
scr_plat_standing_on

function
scr_plat_standing_on(arg0, arg1)
{ if (is_string(arg0)) { if (arg0 == "kr" || arg0 == "kris") { with (obj_plat_player) return grounded && ground == arg1; } else { with (obj_plat_follower) { if ((arg0 == "su" || arg0 == "susie") && name == "susie") return grounded && ground == arg1; if ((arg0 == "ra" || arg0 == "ralsei") && name == "ralsei") return grounded && ground == arg1; } } } else if (variable_instance_exists(arg0, "ground")) { return arg0.grounded && arg0.ground == arg1; } }
("kr", plat))
222
            {
223
                stood_on_ralsei = true;
224
                recovertimer = 0;
225
            }
226
            if (recovertimer >= 20)
227
            {
228
                con = 5;
229
                animate(anim_recover_end);
230
            }
231
        }
232
        if (con == 10)
233
        {
234
            if (timer == 1)
235
            {
236
                if (abs(x - xstart) < 2)
237
                    timer = 25;
238
            }
239
            x = lerp(x, xstart, min(timer / 30, 1));
240
            lerptimer = 0;
241
            if (timer >= 31)
242
            {
243
                if (lensorder == 0)
244
                    lensorder = choose(-1, 1);
245
                else
246
                    lensorder = -lensorder;
247
                timer = 0;
248
                con = 12;
249
                if (!announced_big_attack)
250
                {
251
                    talkcon = 20;
252
                    con = 11;
253
                    announced_big_attack = true;
254
                    event_user(10);
255
                }
256
            }
257
        }
258
        else if (con == 11)
259
        {
260
            x = lerp(x, xstart, min(timer / 30, 1));
261
            if (timer == 35)
262
            {
263
                snd_play(snd_petaldrain);
264
                var of = 
scr_oflash
scr_oflash

function
scr_oflash()
{ _oflash = instance_create(x, y, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_angle = image_angle; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
265
                of.flashcolor = c_aqua;
266
            }
267
            if (timer == 42)
268
            {
269
                con = 12;
270
                timer = 0;
271
            }
272
        }
273
        else if (con == 12)
274
        {
275
            x = lerp(x, xstart, min(timer / 30, 1));
276
            if (timer >= 3 && (timer % 3) == 0 && timer <= 16)
277
            {
278
                var xx = x - (92 * lensorder);
279
                var yy = y;
280
                create_bullet(270 + (lensorder * (-55 + lerp(0, 110, (timer - 4) / 15))), xx, yy);
281
                snd_play(motor_upper_quick, 1, 0.8 + (((timer - 3) / 3) * 0.1));
282
                left_lens_opacity = 0.4;
283
                right_lens_opacity = 0.4;
284
            }
285
            if (timer == 23)
286
            {
287
                if (lensorder == 1)
288
                    animate(anim_super_left);
289
                else
290
                    animate(anim_super_right);
291
            }
292
            if (timer == 150)
293
            {
294
                var of = 
scr_oflash
scr_oflash

function
scr_oflash()
{ _oflash = instance_create(x, y, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_angle = image_angle; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
295
                of.flashcolor = c_aqua;
296
                snd_play(snd_petaldrain);
297
            }
298
            if (timer >= 160 && (timer % 3) == 0 && timer <= 175)
299
            {
300
                var xx = x + (92 * lensorder);
301
                var yy = y;
302
                create_bullet(270 + (lensorder * (55 - lerp(0, 110, (timer - 160) / 15))), xx, yy);
303
                snd_play(motor_upper_quick, 1, 0.8 + (((timer - 160) / 3) * 0.1));
304
                left_lens_opacity = 0.4;
305
                right_lens_opacity = 0.4;
306
            }
307
            if (timer == 180)
308
            {
309
                if (lensorder == 1)
310
                    animate(anim_super_right);
311
                else
312
                    animate(anim_super_left);
313
            }
314
            if (timer >= 320)
315
            {
316
                con = 0;
317
                su_act.blocked = false;
318
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("auraalph", auraalph, 0, 15);
319
            }
320
        }
321
        if (con == 20)
322
        {
323
            con = 21;
324
            with (obj_plat_bullet)
325
            {
326
                damage = 0;
327
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ var _doom = instance_create_depth(0, 0, 0, obj_doom); with (_doom) { alarm[0] target = arg0; } return _doom; }
(self, 10);
328
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_alpha", image_alpha, 0, 10);
329
            }
330
            timer = 0;
331
            with (obj_plat_follower)
332
            {
333
                if (name == "ralsei" && is_platform_mode > 0)
334
                    drop_off_platform_mode(true);
335
            }
336
        }
337
        if (con == 21)
338
        {
339
            timer++;
340
            if (jerky_anim != -4)
341
            {
342
                animate(jerky_anim);
343
                jerky_anim = -4;
344
            }
345
        }
346
        if (con == 22)
347
        {
348
            animate(anim_die);
349
            con = 23;
350
        }
351
        if (con == 99)
352
        {
353
            if (timer == 1)
354
            {
355
                hspeed = 0;
356
                vspeed = 0;
357
                animate(anim_die);
358
                with (obj_plat_follower)
359
                {
360
                    if (name == "ralsei")
361
                        drop_off_platform_mode();
362
                }
363
            }
364
        }
365
    }
366
}
367
if (simple)
368
    su_act.blocked = 2;
369
if (con >= 99)
370
    exit;
371
if (lefthit <= 0)
372
{
373
    with (left_lens_hitbox)
374
    {
375
        var col = instance_place(x, y, obj_plat_hbx);
376
        if (col != -4)
377
        {
378
            with (other)
379
                get_hit_local(-1, col);
380
        }
381
        if (other.lefthp > 0)
382
        {
383
            col = instance_place(x, y, obj_plat_enm_smallglove);
384
            if (col != -4 && col.con == 2)
385
            {
386
                with (other)
387
                    get_hit_local(-1, col);
388
            }
389
        }
390
    }
391
}
392
if (righthit <= 0)
393
{
394
    with (right_lens_hitbox)
395
    {
396
        var col = instance_place(x, y, obj_plat_hbx);
397
        if (col != -4)
398
        {
399
            with (other)
400
                get_hit_local(1, col);
401
        }
402
        if (other.righthp > 0)
403
        {
404
            col = instance_place(x, y, obj_plat_enm_smallglove);
405
            if (col != -4 && col.con == 2)
406
            {
407
                with (other)
408
                    get_hit_local(1, col);
409
            }
410
        }
411
    }
412
}