Deltarune script viewer

← back to main script listing

gml_Object_o_coaster_hero_old_Step_0

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