Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_ch3_PTB02_roaringknight_Step_0

(view raw script w/o annotations or w/e)
1
if (!reach_interrupt && stopsiner2 == false)
2
    siner2++;
3
if (!hover_pause)
4
    y = ystart + (cos(siner2 / 8) * 8);
5
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
6
{
7
    if (keyboard_check_pressed(ord("K")))
8
    {
9
        state = 2;
10
        static_timer = 0;
11
        snd_play(snd_weaponpull);
12
    }
13
}
14
var ignoreaetimer = 0;
15
if (state == 2)
16
    ignoreaetimer = 1;
17
if (state == 3)
18
    ignoreaetimer = 1;
19
aetimer++;
20
if ((aetimer % move_speed) == 0 && image_alpha != 0 && ignoreaetimer == 0)
21
{
22
    if (state == 0)
23
    {
24
        if (draw_sword)
25
        {
26
            draw_timer++;
27
            if (draw_timer == 1)
28
            {
29
                sword_active = true;
30
                sprite_index = spr_roaringknight_sword_appear;
31
                image_index = 0;
32
                image_speed = 0.3;
33
            }
34
            if (draw_timer == 3)
35
            {
36
                image_speed = 0;
37
                sword_appear = true;
38
                
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; }
("sword_alpha", 0, 1, 15, 4, "out");
39
                
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_base_pos", y_base_pos, y_base_pos - 266, 15, -1, "out");
40
            }
41
            if (draw_timer == 8)
42
            {
43
                sword_flash = false;
44
                sword_appear = false;
45
            }
46
            if (draw_timer == 12)
47
            {
48
                sprite_index = spr_roaringknight_sword_appear_new;
49
                image_index = 0;
50
                sword_draw_timer = sword_draw_timestamps[sword_draw_index];
51
                grab_hand = true;
52
            }
53
            if (grab_hand)
54
            {
55
                if (!battle_ready)
56
                {
57
                    sword_draw_timer--;
58
                    if (sword_draw_timer <= 0)
59
                    {
60
                        sword_draw_index++;
61
                        if (sword_draw_index >= array_length(sword_draw_timestamps))
62
                        {
63
                            battle_ready = true;
64
                        }
65
                        else
66
                        {
67
                            sword_draw_timer = sword_draw_timestamps[sword_draw_index];
68
                            image_index = sword_draw_index;
69
                        }
70
                    }
71
                }
72
            }
73
        }
74
        if (after_active)
75
        {
76
            afterimage = instance_create_depth(x, y, depth + 1, obj_afterimage);
77
            afterimage.sprite_index = sprite_index;
78
            afterimage.image_alpha = 0.6;
79
            afterimage.fadeSpeed = 0.02;
80
            afterimage.hspeed = after_image_rate * after_image_dir;
81
            afterimage.image_index = image_index;
82
            afterimage.image_speed = 0;
83
            afterimage.image_xscale = image_xscale;
84
            afterimage.image_yscale = image_yscale;
85
        }
86
    }
87
    if (state == 1)
88
    {
89
        if (after_active)
90
        {
91
            afterimage = instance_create_depth(x, y, depth + 1, obj_afterimage);
92
            afterimage.sprite_index = reach_sprite;
93
            afterimage.image_alpha = 0.6;
94
            afterimage.fadeSpeed = 0.02;
95
            afterimage.hspeed = after_image_rate * after_image_dir;
96
            afterimage.image_index = 3;
97
            afterimage.image_speed = 0;
98
            afterimage.image_xscale = image_xscale;
99
            afterimage.image_yscale = image_yscale;
100
        }
101
    }
102
    if (state == 4)
103
    {
104
        if (i_ex(obj_ch3_PTB02_roaringknight_pull_test))
105
        {
106
            afterimage = instance_create_depth(obj_ch3_PTB02_roaringknight_pull_test.hand_x_pos, obj_ch3_PTB02_roaringknight_pull_test.hand_y_pos, depth + 1, obj_afterimage);
107
            afterimage.sprite_index = spr_roaringknight_arm_reach_grow;
108
            afterimage.image_alpha = 0.6;
109
            afterimage.fadeSpeed = 0.02;
110
            afterimage.hspeed = after_image_rate * after_image_dir;
111
            afterimage.image_index = obj_ch3_PTB02_roaringknight_pull_test.handframe;
112
            afterimage.image_speed = 0;
113
            afterimage.image_xscale = image_xscale;
114
            afterimage.image_yscale = image_yscale;
115
            afterimage = instance_create_depth(obj_ch3_PTB02_roaringknight_pull_test.x, obj_ch3_PTB02_roaringknight_pull_test.y, depth + 1, obj_afterimage);
116
            afterimage.sprite_index = obj_ch3_PTB02_roaringknight_pull_test.base_sprite;
117
            afterimage.image_alpha = 0.6;
118
            afterimage.fadeSpeed = 0.02;
119
            afterimage.hspeed = after_image_rate * after_image_dir;
120
            afterimage.image_index = obj_ch3_PTB02_roaringknight_pull_test.image_index;
121
            afterimage.image_speed = 0;
122
            afterimage.image_xscale = image_xscale;
123
            afterimage.image_yscale = image_yscale;
124
        }
125
    }
126
    if (shakeamt > 0)
127
    {
128
        shaketimer--;
129
        if (shaketimer <= 0)
130
        {
131
            shakex = random_range(-shakeamt, shakeamt);
132
            shakey = random_range(-shakeamt, shakeamt);
133
            shaketimer = shaketime;
134
        }
135
    }
136
    else
137
    {
138
        shakex = 0;
139
        shakey = 0;
140
    }
141
}
142
if (state == 2)
143
{
144
    static_timer++;
145
    if (static_timer == 1)
146
    {
147
        snd_stop(snd_tv_static);
148
        snd_play(snd_tv_static);
149
        sprite_index = spr_roaring_knight_overworld_warp;
150
        image_speed = 0;
151
        image_index = 5;
152
        shakeamt = 4;
153
        scr_delay_var("static_timer", 0, 12);
154
        scr_delay_var("state", 0, 12);
155
    }
156
    if (static_timer == 2)
157
        image_index = 6;
158
    snd_pitch(snd_tv_static, 0.5 + random(1));
159
    if (static_timer == 3)
160
        image_index = 7;
161
    if (static_timer == 4)
162
        image_index = 8;
163
    if (static_timer >= 5)
164
        image_index = choose(6, 7, 8);
165
    if (static_timer == 10)
166
    {
167
        image_index = 6;
168
        snd_stop(snd_tv_static);
169
    }
170
    if (static_timer == 11)
171
        image_index = 5;
172
    if (static_timer >= 12)
173
        image_index = 0;
174
    var after = 
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; }
();
175
    after.depth = depth + 1;
176
    after.image_alpha = 0.5;
177
    after.direction = random(360);
178
    after.speed = 1;
179
}
180
if (state == 3)
181
{
182
    static_timer++;
183
    if (static_timer == 1)
184
    {
185
        sprite_index = spr_roaring_knight_overworld_warp;
186
        image_speed = 0;
187
        static_fx_looping = true;
188
        snd_stop(snd_tv_static);
189
        snd_loop(snd_tv_static);
190
    }
191
    else if ((static_timer % 2) == 0)
192
    {
193
        image_index = 5 + floor(random(3) + 2.8);
194
        shakex = choose(-2, -1, 0, 1, 2);
195
        shakey = choose(-2, -1, 0, 1, 2);
196
        var after = 
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; }
();
197
        after.depth = depth - 1;
198
        after.image_alpha = 0.3;
199
        after.direction = random(360);
200
        after.speed = 1;
201
        after = 
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; }
();
202
        after.depth = depth + 1;
203
        after.image_alpha = 0.5;
204
        after.direction = random(360);
205
        after.speed = 1;
206
        if (floor(random(10)) == 0)
207
            snd_pitch(snd_tv_static, 0.5 + random(1));
208
    }
209
}
210
else if (static_fx_looping)
211
{
212
    static_fx_looping = false;
213
    snd_stop(snd_tv_static);
214
}
215
if (undyne_hat)
216
{
217
    undyne_hat = false;
218
    undyne_hat_release = true;
219
    var hat_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 + 48, y + 20, spr_undyne_dw_hat);
220
    hat_marker.depth = depth - 100;
221
    with (hat_marker)
222
    {
223
        hspeed = -8;
224
        gravity = 1;
225
    }
226
    
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(hat_marker, 60);
227
}
228
if (susie_grab)
229
{
230
    susie_grab_timer++;
231
    if (susie_grab_timer == 1)
232
    {
233
        reach_interrupt = true;
234
        reach_anim_pause = true;
235
        if (i_ex(obj_ch3_PTB02))
236
        {
237
            susie_grab_x = obj_ch3_PTB02.su_actor.x;
238
            susie_grab_y = obj_ch3_PTB02.su_actor.y;
239
        }
240
    }
241
}