Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_o_coaster_hero_Other_24

(view raw script w/o annotations or w/e)
1
if (instance_exists(obj_berdlyb_enemy) && obj_berdlyb_enemy.nitro > 0)
2
    nitro = 1;
3
else
4
    nitro = 0;
5
if (o_coaster_controller.actcon == 1 && o_coaster_controller.timer < o_coaster_controller.timermax && bump == 1)
6
{
7
    if ((HeroID == 0 && gooffscreen == 0) || (HeroID == 1 && gooffscreen == 0) || (HeroID == 2 && gooffscreen == 0))
8
    {
9
        if (visible == 1)
10
        {
11
            bump = 0;
12
            mykeybuffer = 3;
13
            o_coaster_controller.playerinput = 1;
14
            if ((HeroID == 0 && sprite_index != spr_krisb_act) || (HeroID == 0 && sprite_index == spr_krisb_act && image_index > 9))
15
            {
16
                sprite_index = spr_krisb_act;
17
                image_index = 0;
18
                forceact = 1;
19
                image_speed = 0.5;
20
            }
21
            if ((HeroID == 1 && sprite_index != spr_susie_act) || (HeroID == 1 && sprite_index == spr_susie_act && image_index > 8))
22
            {
23
                sprite_index = spr_susie_act;
24
                image_index = 0;
25
                forceact = 1;
26
                image_speed = 0.5;
27
            }
28
            if ((HeroID == 2 && sprite_index != spr_ralsei_act) || (HeroID == 2 && sprite_index == spr_ralsei_act && image_index > 11))
29
            {
30
                sprite_index = spr_ralsei_act;
31
                image_index = 0;
32
                forceact = 1;
33
                image_speed = 0.5;
34
            }
35
        }
36
    }
37
}
38
if (o_coaster_controller.actcon != 0)
39
    actoncondelay = 1;
40
if (instance_exists(obj_battleblcon))
41
    actoncondelay = 0;
42
if (o_coaster_controller.actcon == 0 && actoncondelay == 0 && endscene == 0)
43
{
44
    if (HeroID == 0 && forceact == 0)
45
    {
46
        sprite_index = obj_herokris.sprite_index;
47
        image_index = obj_herokris.image_index - 1;
48
    }
49
    if (HeroID == 1 && forceact == 0 && instance_exists(obj_herosusie))
50
    {
51
        sprite_index = obj_herosusie.sprite_index;
52
        image_index = obj_herosusie.image_index - 1;
53
    }
54
    if (HeroID == 2 && forceact == 0 && instance_exists(obj_heroralsei))
55
    {
56
        sprite_index = obj_heroralsei.sprite_index;
57
        image_index = obj_heroralsei.image_index - 1;
58
    }
59
}
60
if (sprite_index == spr_krisb_act && image_index > 10)
61
{
62
    obj_herokris.sprite_index = spr_krisb_idle;
63
    image_speed = 0.25;
64
    sprite_index = spr_krisb_idle;
65
}
66
if (sprite_index == spr_susie_act && image_index > 9)
67
{
68
    sprite_index = spr_susieb_idle;
69
    image_speed = 0.25;
70
}
71
if (sprite_index == spr_susieb_act && image_index > 9)
72
    sprite_index = spr_susieb_idle;
73
if (sprite_index == spr_ralsei_act && image_index > 11)
74
{
75
    sprite_index = spr_ralsei_idle;
76
    image_speed = 0.25;
77
    forceact = 0;
78
}
79
if (sprite_index == spr_krisb_attack && forceact == 1 && introanim == 1)
80
{
81
    sprite_index = spr_krisb_idle;
82
    image_speed = 0;
83
    image_index = 0;
84
    forceact = 0;
85
    introanim = 0;
86
}
87
if (sprite_index == spr_susie_attack && forceact == 1 && introanim == 1)
88
{
89
    sprite_index = spr_susieb_idle;
90
    image_speed = 0;
91
    image_index = 0;
92
    forceact = 0;
93
    introanim = 0;
94
}
95
if (sprite_index == spr_ralsei_battleintro && forceact == 1 && introanim == 1)
96
{
97
    sprite_index = spr_ralsei_idle;
98
    image_speed = 0;
99
    image_index = 9;
100
    forceact = 0;
101
    introanim = 0;
102
}
103
var xx, yy;
104
if (sprite_index == spr_krisb_idle)
105
{
106
    xx = 4;
107
    yy = -11;
108
}
109
else if (sprite_index == spr_krisb_attack)
110
{
111
    xx = 0;
112
    yy = 8;
113
}
114
else if (sprite_index == spr_krisb_attackready)
115
{
116
    xx = 0;
117
    yy = 8;
118
}
119
else if (sprite_index == spr_susie_idle)
120
{
121
    xx = 0;
122
    yy = -9;
123
}
124
else if (sprite_index == spr_susieb_idle)
125
{
126
    xx = 0;
127
    yy = -9;
128
}
129
else if (sprite_index == spr_susieb_itemready)
130
{
131
    xx = 0;
132
    yy = -9;
133
}
134
else if (sprite_index == spr_susieb_item)
135
{
136
    xx = 0;
137
    yy = -9;
138
}
139
else if (sprite_index == spr_ralsei_idle)
140
{
141
    xx = -12;
142
    yy = -9;
143
}
144
else if (sprite_index == spr_ralsei_act)
145
{
146
    xx = -12;
147
    yy = 0;
148
}
149
else if (sprite_index == spr_ralsei_walk_right)
150
{
151
    xx = 0;
152
    yy = -16;
153
}
154
else if (sprite_index == spr_ralsei_right)
155
{
156
    xx = 0;
157
    yy = -16;
158
}
159
else if (sprite_index == spr_krisb_victory)
160
{
161
    xx = 0;
162
    yy = -11;
163
}
164
else if (sprite_index == spr_ralsei_victory)
165
{
166
    xx = 0;
167
    yy = -9;
168
}
169
else if (sprite_index == spr_krisr_dark)
170
{
171
    xx = 5;
172
    yy = -10;
173
}
174
else if (sprite_index == spr_susie_right_dw)
175
{
176
    xx = 10;
177
    yy = -13;
178
}
179
else if (sprite_index == spr_ralsei_walk_right)
180
{
181
    xx = 1;
182
    yy = -2;
183
}
184
else
185
{
186
    xx = 0;
187
    yy = 0;
188
}
189
if (HeroID == 1)
190
    xx = xx - 10;
191
var a = 2;
192
if (sprite_index == spr_susieb_actready)
193
    a = 1.5;
194
if (sprite_index == spr_susieb_act)
195
    a = 1.5;
196
if (sprite_index == spr_susieb_attackready)
197
    a = 1.5;
198
if (sprite_index == spr_susieb_attack)
199
    a = 1.5;
200
if (sprite_index == spr_susieb_defend)
201
    a = 1.5;
202
if (sprite_index == spr_susie_rudebuster)
203
    a = 1.5;
204
if (sprite_index == spr_susie_spell)
205
    a = 1.5;
206
if (sprite_index == spr_susie_spellready)
207
    a = 1.5;
208
if (sprite_index == spr_susie_actready)
209
    a = 1.5;
210
if (sprite_index == spr_susie_act)
211
    a = 1.5;
212
if (sprite_index == spr_susie_attackready)
213
    a = 1.5;
214
if (sprite_index == spr_susie_attack)
215
    a = 1.5;
216
if (sprite_index == spr_susie_defend)
217
    a = 1.5;
218
userealsprite = 0;
219
if (HeroID == 0)
220
{
221
    if (sprite_index == spr_krisb_hurt)
222
    {
223
        obj_herokris.x = x + 20 + xx;
224
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
225
        userealsprite = 1;
226
        obj_herokris.depth = depth + 1;
227
    }
228
    else if (sprite_index == spr_krisb_idle && dontshowherosprite < 1)
229
    {
230
        obj_herokris.x = x + 20 + xx;
231
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
232
        userealsprite = 1;
233
        obj_herokris.depth = depth + 1;
234
    }
235
    else if (sprite_index == spr_krisb_defend)
236
    {
237
        obj_herokris.x = x + 20 + xx;
238
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
239
        userealsprite = 1;
240
        obj_herokris.depth = depth + 1;
241
    }
242
    else if (sprite_index == spr_krisb_item)
243
    {
244
        obj_herokris.x = x + 20 + xx;
245
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
246
        userealsprite = 1;
247
        obj_herokris.depth = depth + 1;
248
    }
249
    else if (sprite_index == spr_krisb_itemready)
250
    {
251
        obj_herokris.x = x + 20 + xx;
252
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
253
        userealsprite = 1;
254
        obj_herokris.depth = depth + 1;
255
    }
256
    else if (sprite_index == spr_krisb_actready)
257
    {
258
        obj_herokris.x = x + 20 + xx;
259
        obj_herokris.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
260
        userealsprite = 1;
261
        obj_herokris.depth = depth + 1;
262
    }
263
    else if (dontshowherosprite > 0)
264
    {
265
        dontshowherosprite--;
266
        userealsprite = 0;
267
    }
268
    else
269
    {
270
        obj_herokris.x = camerax() - 300;
271
    }
272
}
273
if (HeroID == 1 && instance_exists(obj_herosusie))
274
{
275
    if (sprite_index == spr_susie_hurt)
276
    {
277
        obj_herosusie.x = x + 20 + xx;
278
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
279
        userealsprite = 1;
280
        obj_herosusie.depth = depth + 1;
281
    }
282
    else if (sprite_index == spr_susieb_idle && dontshowherosprite < 1)
283
    {
284
        obj_herosusie.x = x + 20 + xx;
285
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
286
        userealsprite = 1;
287
        obj_herosusie.depth = depth + 1;
288
    }
289
    else if (sprite_index == spr_susieb_hurt)
290
    {
291
        obj_herosusie.x = x + 20 + xx;
292
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
293
        userealsprite = 1;
294
        obj_herosusie.depth = depth + 1;
295
    }
296
    else if (obj_herosusie.hurt > 0)
297
    {
298
        obj_herosusie.x = x + 20 + xx;
299
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
300
        userealsprite = 1;
301
        obj_herosusie.depth = depth + 1;
302
    }
303
    else if (sprite_index == spr_susieb_defend)
304
    {
305
        obj_herosusie.x = x + 20 + xx;
306
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
307
        userealsprite = 1;
308
        obj_herosusie.depth = depth + 1;
309
    }
310
    else if (sprite_index == spr_susie_rudebuster)
311
    {
312
        obj_herosusie.x = x + 20 + xx;
313
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
314
        userealsprite = 1;
315
        obj_herosusie.depth = depth + 1;
316
    }
317
    else if (instance_exists(obj_rudebuster_anim))
318
    {
319
        obj_rudebuster_anim.x = x + 20 + xx;
320
        obj_rudebuster_anim.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
321
        obj_herosusie.x = x + 20 + xx;
322
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
323
        userealsprite = 1;
324
        obj_herosusie.depth = depth + 1;
325
    }
326
    else if (sprite_index == spr_susie_spell)
327
    {
328
        obj_herosusie.x = x + 20 + xx;
329
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
330
        userealsprite = 1;
331
        obj_herosusie.depth = depth + 1;
332
    }
333
    else if (sprite_index == spr_susie_spellready)
334
    {
335
        obj_herosusie.x = x + 20 + xx;
336
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
337
        userealsprite = 1;
338
        obj_herosusie.depth = depth + 1;
339
    }
340
    else if (sprite_index == spr_susieb_actready)
341
    {
342
        obj_herosusie.x = x + 20 + xx;
343
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
344
        userealsprite = 1;
345
        obj_herosusie.depth = depth + 1;
346
    }
347
    else if (sprite_index == spr_susieb_itemready)
348
    {
349
        obj_herosusie.x = x + 20 + xx;
350
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
351
        userealsprite = 1;
352
        obj_herosusie.depth = depth + 1;
353
    }
354
    else if (sprite_index == spr_susieb_item)
355
    {
356
        obj_herosusie.x = x + 20 + xx;
357
        obj_herosusie.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
358
        userealsprite = 1;
359
        obj_herosusie.depth = depth + 1;
360
    }
361
    else if (dontshowherosprite > 0)
362
    {
363
        dontshowherosprite--;
364
        userealsprite = 0;
365
    }
366
    else
367
    {
368
        obj_herosusie.x = camerax() - 300;
369
    }
370
}
371
if (HeroID == 2 && instance_exists(obj_heroralsei))
372
{
373
    if (sprite_index == spr_ralsei_idle && dontshowherosprite < 1)
374
    {
375
        obj_heroralsei.x = x + 20 + xx;
376
        obj_heroralsei.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
377
        userealsprite = 1;
378
        obj_heroralsei.depth = depth + 1;
379
    }
380
    else if (sprite_index == spr_ralsei_hurt_fixed)
381
    {
382
        obj_heroralsei.x = x + 20 + xx;
383
        obj_heroralsei.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
384
        userealsprite = 1;
385
        obj_heroralsei.depth = depth + 1;
386
    }
387
    else if (sprite_index == spr_ralsei_defend)
388
    {
389
        obj_heroralsei.x = x + 20 + xx;
390
        obj_heroralsei.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
391
        userealsprite = 1;
392
        obj_heroralsei.depth = depth + 1;
393
    }
394
    else if (sprite_index == spr_ralsei_item)
395
    {
396
        obj_heroralsei.x = x + 20 + xx;
397
        obj_heroralsei.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
398
        userealsprite = 1;
399
        obj_heroralsei.depth = depth + 1;
400
    }
401
    else if (sprite_index == spr_ralsei_itemready)
402
    {
403
        obj_heroralsei.x = x + 20 + xx;
404
        obj_heroralsei.y = (y - (sprite_get_height(sprite_index) * a)) + yy + 8;
405
        userealsprite = 1;
406
        obj_heroralsei.depth = depth + 1;
407
    }
408
    else if (dontshowherosprite > 0)
409
    {
410
        dontshowherosprite--;
411
        userealsprite = 0;
412
    }
413
    else
414
    {
415
        obj_heroralsei.x = camerax() - 300;
416
    }
417
}
418
if (endscene == 1 && instance_exists(obj_ch2_scene11a))
419
{
420
    if (HeroID == 0)
421
    {
422
        xx = obj_ch2_scene11a.coaster_kris.x + obj_ch2_scene11a.coaster_kris.sinerx + obj_ch2_scene11a.coaster_kris.coaster_offset_x;
423
        yy = obj_ch2_scene11a.coaster_kris.y + 37 + obj_ch2_scene11a.coaster_kris.sinery + obj_ch2_scene11a.coaster_kris.coaster_offset_y;
424
    }
425
    if (HeroID == 1)
426
    {
427
        xx = obj_ch2_scene11a.coaster_susie.x + obj_ch2_scene11a.coaster_susie.sinerx + obj_ch2_scene11a.coaster_susie.coaster_offset_x;
428
        yy = obj_ch2_scene11a.coaster_susie.y + 37 + obj_ch2_scene11a.coaster_susie.sinery + obj_ch2_scene11a.coaster_susie.coaster_offset_y;
429
    }
430
    if (HeroID == 2)
431
    {
432
        xx = obj_ch2_scene11a.coaster_ralsei.x + 8 + obj_ch2_scene11a.coaster_ralsei.sinerx + obj_ch2_scene11a.coaster_ralsei.coaster_offset_x;
433
        yy = obj_ch2_scene11a.coaster_ralsei.y + 44 + obj_ch2_scene11a.coaster_ralsei.sinery + obj_ch2_scene11a.coaster_ralsei.coaster_offset_y;
434
    }
435
    if (endscenetimer < 10)
436
        endscenetimer++;
437
    x = lerp(x, xx, endscenetimer / 10);
438
    y = lerp(y, yy, endscenetimer / 10);
439
}
440
if (disabled == 1)
441
{
442
    disabledtimer--;
443
    if (disabledtimer <= 0)
444
        disabled = 0;
445
}
446
if (con == 0)
447
{
448
    siner += 0.4;
449
    if (gooffscreen == 0 && endscene == 0)
450
        x = xstart + (sin(siner / 6) * 3);
451
    if (mykeybuffer > 0 && disabled == 0)
452
    {
453
        con = 1;
454
        snd_play_pitch(snd_drive, 1 + random(0.2));
455
        dashtimer = 0;
456
        damaged = 0;
457
        with (o_coaster_controller)
458
            buttonspressed += 1;
459
    }
460
}
461
if (con == 1)
462
{
463
    if (nitro == 0)
464
    {
465
        if (obj_berdlyb_enemy.bumpactfast == 1)
466
        {
467
            hspeed += 6;
468
            if (hspeed > 45)
469
                hspeed = 45;
470
        }
471
        else
472
        {
473
            hspeed += 4;
474
            if (hspeed > 30)
475
                hspeed = 30;
476
        }
477
    }
478
    if (nitro == 1)
479
    {
480
        hspeed += 8;
481
        if (hspeed > 60)
482
            hspeed = 60;
483
    }
484
    smoketimer += 2;
485
    if (smoketimer >= 3)
486
        smoketimer = 0;
487
    if (x >= (camerax() + 200))
488
        con = 2;
489
    if (damaged == 1)
490
    {
491
        con = 5;
492
        hspeed = -48;
493
        if (nitro == 1)
494
            hspeed = -200;
495
    }
496
}
497
if (con == 2)
498
{
499
    if (damaged == 1)
500
        con = 5;
501
    if (hspeed >= -6)
502
        hspeed -= 2;
503
    if (nitro == 1)
504
    {
505
        hspeed -= 1;
506
        if (x >= (camerax() + 400) && hspeed > 0)
507
            hspeed = -2;
508
    }
509
    if (x <= (xstart + 10))
510
    {
511
        damaged = 0;
512
        hspeed = 0;
513
        siner = 0;
514
        con = 0;
515
    }
516
}
517
if (con == 5)
518
{
519
    hspeed = -30;
520
    if (nitro == 1)
521
        hspeed = -100;
522
    if (x <= (xstart - hspeed))
523
    {
524
        hspeed = 0;
525
        damaged = 0;
526
        siner = 0;
527
        con = 0;
528
    }
529
}
530
mykeybuffer -= 1;
531
if (gooffscreen == 2)
532
{
533
    if (HeroID == 0)
534
        x -= 2;
535
}