Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_ch4_DCC01_roaringknight_Step_0

(view raw script w/o annotations or w/e)
1
if (state == 0)
2
{
3
    siner2++;
4
    y = ystart + (cos(siner2 / 8) * 8);
5
    aetimer++;
6
    if ((aetimer % move_speed) == 0 && image_alpha != 0)
7
    {
8
        if (state == 0)
9
        {
10
            var afterimage = instance_create_depth(x, y, depth + 1, obj_afterimage);
11
            afterimage.sprite_index = sprite_index;
12
            afterimage.image_alpha = 0.6;
13
            afterimage.fadeSpeed = 0.02;
14
            afterimage.hspeed = after_image_rate * after_image_dir;
15
            afterimage.image_index = image_index;
16
            afterimage.image_speed = 0;
17
            afterimage.image_xscale = image_xscale;
18
            afterimage.image_yscale = image_yscale;
19
        }
20
    }
21
}
22
if (state == 1)
23
{
24
    timer++;
25
    if (done == 0)
26
    {
27
    }
28
    if (done == 1)
29
    {
30
        makespear = 0;
31
        state = 0;
32
        done = 0;
33
    }
34
    if (spear_dodge == 1)
35
    {
36
        var gox = xstart + (choose(40, 50, 60, 70) * choose(rem1));
37
        var goy = ystart + (choose(20, 30, 40) * choose(-1, 1));
38
        if (done)
39
            gox = xstart;
40
        if (done)
41
            goy = ystart;
42
        con = 2;
43
        var offset = 6;
44
        
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, gox, 12 - offset, 2, "out");
45
        
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, goy, 12 - offset, 2, "out");
46
        rem1 *= -1;
47
        spear_dodge = 0;
48
        sprite_index = spr_roaringknight_ball_transition_reverse;
49
        image_speed = 0;
50
        image_index = 0;
51
        
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; }
("image_index", 4, 0, 12 - offset);
52
        scr_delay_var("sprite_index", 2221, 12 - offset);
53
        
scr_script_delayed
scr_script_delayed

function
scr_script_delayed()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = argument[1]; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 2); __i++) __scriptdelay.script_arg[__i] = argument[__i + 2]; __scriptdelay.arg_count = argument_count - 2; return __scriptdelay; }
(scr_lerpvar, 12 - offset, "image_index", 0, 4, 12 - offset);
54
        snd_play(snd_knight_teleport);
55
    }
56
    if ((timer % 2) == 0)
57
    {
58
        var afterimage = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
59
        afterimage.image_alpha = 0.8;
60
        afterimage.direction = random(360);
61
        afterimage.speed = 2;
62
    }
63
}
64
if (state == 2)
65
{
66
    timer++;
67
    if (timer == 1)
68
    {
69
        sprite_index = spr_roaringknight_looking;
70
        image_index = 0;
71
    }
72
    if (timer == 5)
73
        image_index = 1;
74
    if (timer == 47)
75
        image_index = 2;
76
    if (timer == 53)
77
        image_index = 3;
78
    if (timer == 93)
79
        timer = 0;
80
    siner2++;
81
    y = ystart + (cos(siner2 / 8) * 8);
82
    aetimer++;
83
    if ((aetimer % move_speed) == 0 && image_alpha != 0)
84
    {
85
        var afterimage = instance_create_depth(x, y, depth + 1, obj_afterimage);
86
        afterimage.sprite_index = sprite_index;
87
        afterimage.image_alpha = 0.6;
88
        afterimage.fadeSpeed = 0.02;
89
        afterimage.hspeed = after_image_rate * after_image_dir;
90
        afterimage.image_index = image_index;
91
        afterimage.image_speed = 0;
92
        afterimage.image_xscale = image_xscale;
93
        afterimage.image_yscale = image_yscale;
94
    }
95
}
96
if (state == 3)
97
{
98
    if (con == 0)
99
    {
100
        con = -1;
101
        sprite_index = spr_roaringknight_throw_sword;
102
        image_index = 0;
103
        image_speed = 0;
104
        scr_lerp_var_instance(id, "image_index", 0, 4, 30);
105
    }
106
    if (con == 1)
107
    {
108
        con = -1;
109
        sprite_index = spr_roaringknight_throw_sword;
110
        image_index = 4;
111
        scr_lerp_var_instance(id, "image_index", 4, 11, 30);
112
        scr_delay_var("state", -1, 40);
113
    }
114
}
115
if (state == 4)
116
{
117
    if (con == 0)
118
    {
119
        con = 1;
120
        timer = 0;
121
        sprite_index = spr_roaringknight_throw_sword;
122
        image_index = 13;
123
        var yoffset = -400;
124
        scr_lerp_var_instance(id, "y", y, (y - 320) + yoffset, 45, 1, "out");
125
        sword_marker = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(x + 120, y + 10, spr_roaringknight_sword_throw);
126
        image_angle = 20;
127
        sword_marker.swordid = 0;
128
        var snd = snd_play(snd_knight_jump, 0, 0.4);
129
        snd_volume(snd, 1, 8);
130
        sword_marker.depth = depth - 10;
131
        sword_marker.init = 1;
132
        with (sword_marker)
133
        {
134
            
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; }
("image_angle", image_angle, 720, 50, 1, "out");
135
            image_xscale = 2;
136
            image_yscale = 2;
137
        }
138
    }
139
    if (con == 1)
140
    {
141
        timer++;
142
        if (timer == 25)
143
        {
144
            for (var i = -2; i <= 2; i++)
145
            {
146
                if (i != 0)
147
                {
148
                    with (
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(x + 120, y + 10, spr_roaringknight_sword_throw))
149
                    {
150
                        depth = other.depth - 12;
151
                        swordid = i;
152
                        image_xscale = 2;
153
                        image_yscale = 2;
154
                        
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; }
("image_angle", image_angle, 360 - (2 * i), 25, 1, "out");
155
                        init = 0;
156
                    }
157
                }
158
            }
159
        }
160
        with (obj_marker)
161
        {
162
            if (sprite_index == spr_roaringknight_sword_throw)
163
            {
164
                x = other.x + 120 + (swordid * 40 * (max(other.timer - 25, 0) / 25)) + lengthdir_x(80, 90 + (180 * (other.timer / 50)));
165
                y = (other.y - 20) + (abs(swordid) * 10 * (max(other.timer - 25, 0) / 25)) + lengthdir_y(140, -90 + (180 * (other.timer / 50)));
166
            }
167
        }
168
        scr_delay_var("sword_flash_active", true, 5);
169
        if (timer >= 50)
170
        {
171
            con = -1;
172
            timer = 0;
173
            scr_delay_var("con", 3, 25);
174
        }
175
    }
176
    if (sword_flash_active)
177
    {
178
        with (obj_marker)
179
        {
180
            if (sprite_index == spr_roaringknight_sword_throw)
181
            {
182
                if (init == 0)
183
                {
184
                    init = 1;
185
                }
186
                else
187
                {
188
                    with (
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
())
189
                    {
190
                        image_alpha = 0.5;
191
                        vspeed = other.vspeed;
192
                    }
193
                }
194
            }
195
        }
196
    }
197
    if (con == 3)
198
    {
199
        con = 4;
200
        sword_flash_active = false;
201
        with (sword_marker)
202
            image_alpha = 1;
203
        target_flash_active = true;
204
        scr_delay_var("target_flash_active", false, 20);
205
        scr_delay_var("con", 5, 5);
206
        scr_delay_var("timer", 0, 5);
207
    }
208
    if (target_flash_active)
209
    {
210
        snd_play(snd_fountain_target);
211
        blazetimer++;
212
        anim = instance_create((x - 100) + (blazetimer * 6 * 4), y + 10 + random(20), obj_animation);
213
        anim.sprite_index = spr_kris_make_fountain_flash;
214
        anim.image_xscale = 2;
215
        anim.image_yscale = 2;
216
        anim.image_speed = 0.5;
217
        anim.depth = depth + 10;
218
    }
219
    if (con == 5)
220
    {
221
        timer++;
222
        if (timer == 1)
223
            image_index = 14;
224
        if ((timer % 2) == 1)
225
        {
226
            with (obj_marker)
227
            {
228
                if (sprite_index == spr_roaringknight_sword_throw && (5 + (2 * swordid)) == other.timer)
229
                {
230
                    var xspd = lengthdir_x(1, image_angle - 90);
231
                    var yspd = lengthdir_y(1, image_angle - 90);
232
                    
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; }
("hspeed", -14 * xspd, 0, 12, 1, "out");
233
                    
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; }
("vspeed", -14 * yspd, 0, 12, 1, "out");
234
                    scr_delay_var("hspeed", 80 * xspd, 18);
235
                    scr_delay_var("vspeed", 80 * yspd, 18);
236
                }
237
            }
238
        }
239
        if (timer >= 19 && timer <= 27 && (timer % 2) == 1)
240
        {
241
            snd_stop(snd_chargeshot_fire);
242
            snd_play(snd_chargeshot_fire, 1, 1.4);
243
        }
244
        var advanceframe = [];
245
        advanceframe[5] = true;
246
        var delay = 16;
247
        advanceframe[2 + delay] = true;
248
        advanceframe[4 + delay] = true;
249
        advanceframe[6 + delay] = true;
250
        advanceframe[8 + delay] = true;
251
        if (array_length(advanceframe) > timer && advanceframe[timer])
252
            image_index++;
253
        if (timer >= (delay + 2) && timer <= (delay + 10) && (timer % 2) == 0)
254
        {
255
            var scale = 4;
256
            var idx = -(timer - delay - 6) / 2;
257
            with (instance_create((camerax() + (0.5 * camerawidth())) - (10 * scale), y - 400, obj_marker))
258
            {
259
                sprite_index = spr_pxwhite;
260
                image_xscale = 20 * scale;
261
                image_angle = idx * 3;
262
                x -= (60 * idx);
263
                
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; }
("image_xscale", 20 * scale, 0, 4);
264
                
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, x + (10 * scale), 4);
265
                
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; }
("image_alpha", 1, 0, 8);
266
                image_yscale = 1000;
267
                
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(self, 8);
268
            }
269
        }
270
        if (timer == (delay + 11))
271
        {
272
            con = 7;
273
            timer = 0;
274
        }
275
    }
276
    if (con == 7 || con == 8)
277
    {
278
        if (con == 7)
279
        {
280
            with (obj_marker)
281
            {
282
                if (sprite_index == spr_roaringknight_sword_throw)
283
                {
284
                    scr_lerp_var_instance(id, "image_xscale", image_xscale, 1, 10);
285
                    scr_lerp_var_instance(id, "image_yscale", image_yscale, 4, 10);
286
                    
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(id, 10);
287
                    
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
().image_alpha = 0.4;
288
                }
289
            }
290
            con = 8;
291
            scr_delay_var("con", 9, 18);
292
            scr_delay_var("con", 10, 40);
293
        }
294
        else
295
        {
296
            timer++;
297
            with (obj_marker)
298
            {
299
                if (sprite_index == spr_roaringknight_sword_throw)
300
                    
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
().image_alpha = 0.3 + ((0.4 * other.timer) / 10);
301
            }
302
        }
303
    }
304
    if (con == 9)
305
    {
306
        with (
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(0, 13, spr_titan_fountain_loop_base_white))
307
        {
308
            depth = other.depth;
309
            image_alpha = 1;
310
            
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; }
("image_alpha", 1, 0, 30);
311
            
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(self, 30);
312
        }
313
        thundersound = snd_play(snd_thunder_boom_2, 1, 0.5);
314
        snd_volume(thundersound, 0, 90);
315
        snd_stop_delay(thundersound, 90);
316
        con = 9.5;
317
    }
318
}