Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_climb_susie_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
    init = 1;
3
event_inherited();
4
depth = 31000;
5
if (con == 0)
6
{
7
    sprite_index = spr_susie_climb;
8
    image_index = climbindex;
9
    if (reachcon >= 10)
10
    {
11
        con = 4;
12
        exit;
13
    }
14
    if (reachcon > 0)
15
    {
16
        con = 3;
17
        exit;
18
    }
19
    if (waiteventid > 0)
20
        exit;
21
    remx = x;
22
    remy = y;
23
    if (forcejump)
24
    {
25
        con = 2;
26
        forcejump = 0;
27
        exit;
28
    }
29
    if (dir >= 0)
30
    {
31
        con = 1;
32
        climbcon = 0;
33
    }
34
}
35
if (con == 1)
36
{
37
    if (climbcon == 0)
38
    {
39
        yclimb = 0;
40
        xclimb = 0;
41
        if (dir == 2)
42
            yclimb = -40;
43
        else if (dir == 3)
44
            xclimb = -40;
45
        else if (dir == 1)
46
            xclimb = 40;
47
        else
48
            yclimb = 40;
49
        sprite_index = spr_susie_climb;
50
        if (climbindex == 0)
51
            climbindex = 2;
52
        else
53
            climbindex = 0;
54
        climbcon = 1;
55
    }
56
    if (climbcon == 1)
57
    {
58
        var draw_dust = !onrotatingtower || tile_vis == 1;
59
        if (timer == 0 && draw_dust)
60
        {
61
            var dust_amount = 1;
62
            if (jumping)
63
                dust_amount = 5;
64
            for (var i = 0; i < dust_amount; i++)
65
            {
66
                var dust = instance_create(x + 20, y + 80, obj_animation);
67
                dust.sprite_index = spr_climb_dust_small;
68
                dust.depth = depth + 10;
69
                if (jumping)
70
                {
71
                    dust.x = dust.x + random_range(-10, 10);
72
                    dust.y = dust.y + random_range(-10, 10);
73
                }
74
                else if (yclimb < 0)
75
                {
76
                    dust.x = (dust.x - 10) + (10 * climbindex);
77
                }
78
                else if (yclimb > 0)
79
                {
80
                    dust.x = (dust.x - 15) + (15 * climbindex);
81
                }
82
                else
83
                {
84
                    dust.y = dust.y + 10;
85
                }
86
                if (i_ex(obj_rotating_tower_controller_new) && i_ex(obj_climb_kris))
87
                {
88
                    dust.x = tower_x;
89
                    dust.depth = obj_rotating_tower_controller_new.depth - 4;
90
                }
91
                dust.image_xscale = 2;
92
                dust.image_yscale = 2;
93
                dust.image_speed = 0.5;
94
                dust.vspeed += -1;
95
            }
96
        }
97
        drawoffsety = 0;
98
        var newx, newy, climbrate;
99
        if (jumping == 0)
100
        {
101
            if (climbspeed < climbspeedmultiplier)
102
                climbspeed = climbspeedmultiplier;
103
            timer += (climbspeed + climbmomentum);
104
            climbrate = 10;
105
            if (timer >= climbrate)
106
                timer = climbrate;
107
            newx = lerp_ease_inout(remx, remx + xclimb, timer / climbrate, 2);
108
            newy = lerp_ease_inout(remy, remy + yclimb, timer / climbrate, 2);
109
            image_index = climbindex;
110
            if (abs(newx - remx) > 3 || abs(newy - remy) > 3)
111
                image_index = 1 + climbindex;
112
        }
113
        else
114
        {
115
            timer += 1;
116
            climbrate = 6 + (jumpchargeamount * 2);
117
            var clipamount = 4;
118
            if (jumpchargeamount >= 2)
119
                clipamount = 2;
120
            if (timer >= climbrate)
121
                timer = climbrate;
122
            if (timer >= (climbrate - clipamount))
123
                timer = climbrate;
124
            newx = lerp_ease_out(remx, remx + xclimb, timer / climbrate, 1);
125
            newy = lerp_ease_out(remy, remy + yclimb, timer / climbrate, 1);
126
            drawoffsety = -sin((timer / climbrate) * pi) * (2 * (jumpchargeamount - 1));
127
            if (dir == 2 || dir == 0)
128
            {
129
                image_index = timer / 2;
130
                sprite_index = spr_kris_climb_new_jump_up;
131
            }
132
            else if (dir == 1)
133
            {
134
                if ((timer / climbrate) > 0.5)
135
                {
136
                    sprite_index = spr_kris_climb_new_land_right;
137
                }
138
                else
139
                {
140
                    sprite_index = spr_kris_climb_new_slip_right;
141
                    image_index = 0;
142
                }
143
            }
144
            else if ((timer / climbrate) > 0.5)
145
            {
146
                sprite_index = spr_kris_climb_new_land_left;
147
            }
148
            else
149
            {
150
                sprite_index = spr_kris_climb_new_slip_left;
151
                image_index = 0;
152
            }
153
            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; }
();
154
            afterimage.y = afterimage.y + drawoffsety;
155
            afterimage.image_alpha = 0.2;
156
            if (i_ex(obj_rotating_tower_controller_new) && i_ex(obj_climb_kris))
157
            {
158
                afterimage.x = obj_rotating_tower_controller_new.tower_x;
159
                afterimage.hspeed = -xclimb * 0.1;
160
                afterimage.depth = obj_rotating_tower_controller_new.depth - 4;
161
            }
162
        }
163
        x = newx;
164
        y = newy;
165
        if (timer >= climbrate)
166
        {
167
            if (jumping == 1)
168
                climbmomentum = jumpchargeamount / 2;
169
            jumping = 0;
170
            climbcon = 0;
171
            jumpchargeamount = 0;
172
            x = remx + xclimb;
173
            y = remy + yclimb;
174
            if (onrotatingtower && x > obj_rotating_tower_controller_new.tower_circumference)
175
                x -= obj_rotating_tower_controller_new.tower_circumference;
176
            if (onrotatingtower && x < 0)
177
                x += obj_rotating_tower_controller_new.tower_circumference;
178
            con = 0;
179
            timer = 0;
180
        }
181
    }
182
}
183
if (con == 3 || con == 4)
184
{
185
    sprite_index = spr_susie_climb_throw_catch;
186
    if (con == 3)
187
        sprite_index = spr_susie_climb_throw;
188
    image_speed = 0;
189
    if (timer == 0)
190
    {
191
        image_index = 1;
192
        if (instance_place(x + 35, y, obj_climb_kris) && (obj_climb_kris.climbcon == 2 || obj_climb_kris.neutralcon == 1 || obj_climb_kris.fallingcon > 0))
193
        {
194
            snd_play(snd_noise);
195
            with (obj_climb_kris)
196
            {
197
                image_alpha = 0;
198
                fallingcon = 0;
199
                jumping = 0;
200
                climbcon = 0;
201
                neutralcon = 1;
202
                if (other.onrotatingtower)
203
                {
204
                    visible = 0;
205
                    climb_finished = true;
206
                }
207
            }
208
            if (onrotatingtower)
209
                con = 5;
210
            global.interact = 1;
211
            timer++;
212
            if (con == 4)
213
                x -= 6;
214
        }
215
    }
216
    if (timer > 0)
217
    {
218
        timer++;
219
        var delay = (con * 10) - 10;
220
        if (timer < delay)
221
        {
222
            image_index = 2 + min(4, floor(timer / 4));
223
        }
224
        else
225
        {
226
            image_index = 6 + min(3, floor((timer - delay) / 4));
227
            if (timer == (delay + 8))
228
            {
229
                var targetx = 0;
230
                var targety = 0;
231
                with (obj_genmarker)
232
                {
233
                    if (extflag == string(other.reachcon))
234
                    {
235
                        targetx = x;
236
                        targety = y;
237
                        break;
238
                    }
239
                }
240
                with (obj_climb_kris)
241
                {
242
                    
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, targetx, 25);
243
                    
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, targety - 20, 25);
244
                }
245
                with (instance_create(obj_climb_kris.x, obj_climb_kris.y - 20, obj_marker))
246
                {
247
                    
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(targetx, targety - 20, 10, 25);
248
                    depth = obj_climb_kris.depth;
249
                    sprite_index = spr_kris_jump_ball;
250
                    image_xscale = 2;
251
                    image_yscale = 2;
252
                    
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, 25);
253
                }
254
                snd_play(snd_jump);
255
            }
256
            if (timer == (delay + 34))
257
            {
258
                var targetx = 0;
259
                var targety = 0;
260
                with (obj_genmarker)
261
                {
262
                    if (extflag == string(other.reachcon))
263
                    {
264
                        targetx = x;
265
                        targety = y;
266
                        break;
267
                    }
268
                }
269
                snd_play(snd_noise);
270
                obj_climb_kris.x = targetx + 20;
271
                obj_climb_kris.y = targety + 20;
272
                obj_climb_kris.image_alpha = 1;
273
                global.interact = 0;
274
                sprite_index = spr_susie_climb;
275
                con = 0;
276
                reachcon = 0;
277
            }
278
        }
279
    }
280
}
281
if (con == 5)
282
{
283
    if (timer == 0)
284
    {
285
        sprite_index = spr_susie_climb_throw_alt;
286
        image_index = 0;
287
    }
288
    else
289
    {
290
        sprite_index = spr_susie_climb_throw;
291
    }
292
    if (timer > 0)
293
    {
294
        timer++;
295
        var delay = 20;
296
        if (timer < delay)
297
        {
298
            image_index = 2 + min(4, floor(timer / 4));
299
        }
300
        else
301
        {
302
            image_index = 6 + min(3, floor((timer - delay) / 4));
303
            var jumptime = 100;
304
            if (timer == (delay + 8))
305
            {
306
                with (instance_create(camerax() + (0.5 * camerawidth()), obj_climb_kris.y - 20, obj_marker))
307
                {
308
                    
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
((camerax() - 19) + (0.5 * camerawidth()), ((cameray() - 42) + (0.5 * cameraheight())) - 416, 25, jumptime);
309
                    sprite_index = spr_kris_jump_ball;
310
                    image_xscale = 2;
311
                    image_yscale = 2;
312
                    depth = 100;
313
                }
314
                snd_play(snd_jump);
315
            }
316
            if (timer > (delay + 8) && timer <= (delay + 60))
317
                obj_climb_kris.y -= 8;
318
            if (timer == (delay + 30))
319
            {
320
                whiteout = 
scr_marker_ext
scr_marker_ext

function
scr_marker_ext(arg0, arg1, arg2, arg3 = 1, arg4 = 1, arg5 = 0, arg6 = 0, arg7 = 16777215, arg8 = depth, arg9 = false, arg10 = -1, arg11 = 1)
{ var thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { depth = arg8; sprite_index = arg2; image_speed = arg5; image_xscale = arg3; image_yscale = arg4; image_index = arg6; image_blend = arg7; image_alpha = arg11; if (arg9)
scr_depth_alt();
} if (arg10 > 0)
scr_doom(thismarker, arg10);
return thismarker; } function scr_marker_fromasset(arg0, arg1 = depth, arg2 = false) { if (is_undefined(arg0)) { debug_message("Warning: scr_marker_fromasset() sprite_instance didn't exist"); return -4; } var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var imagespeed = layer_sprite_get_speed(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var thismarker = instance_create_depth(xloc, yloc, arg1, obj_marker); with (thismarker) { sprite_index = sprite; image_index = index; image_speed = imagespeed; image_xscale = xscale; image_yscale = yscale; image_angle = angle; image_blend = blend; image_alpha = alpha; if (arg2)
scr_depth_alt(id, arg2);
} return thismarker; } function scr_assetgetinfo(arg0) { var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var imagespeed = layer_sprite_get_speed(arg0); return [sprite, index, xloc, yloc, xscale, yscale, angle, blend, alpha, imagespeed]; }
(0, 0, spr_pxwhite, room_width, room_height, undefined, undefined, c_white, 101);
321
                with (whiteout)
322
                {
323
                    image_alpha = 0;
324
                    
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", 0, 1, 30);
325
                }
326
            }
327
            if (timer == (delay + 8 + jumptime))
328
            {
329
                snd_play(snd_noise);
330
                with (obj_marker)
331
                {
332
                    if (depth == 100)
333
                    {
334
                        y -= 6;
335
                        newmarker = instance_create(x, y, obj_marker_screen);
336
                        newmarker.sprite_index = spr_kris_dw_landed;
337
                        newmarker.image_speed = 0;
338
                        newmarker.depth = 10;
339
                        with (newmarker)
340
                            
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
341
                        newmarker.persistent = true;
342
                        
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; } }
(newmarker, 100);
343
                        
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
344
                        instance_destroy();
345
                    }
346
                }
347
                blackout = 
scr_marker_ext
scr_marker_ext

function
scr_marker_ext(arg0, arg1, arg2, arg3 = 1, arg4 = 1, arg5 = 0, arg6 = 0, arg7 = 16777215, arg8 = depth, arg9 = false, arg10 = -1, arg11 = 1)
{ var thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { depth = arg8; sprite_index = arg2; image_speed = arg5; image_xscale = arg3; image_yscale = arg4; image_index = arg6; image_blend = arg7; image_alpha = arg11; if (arg9)
scr_depth_alt();
} if (arg10 > 0)
scr_doom(thismarker, arg10);
return thismarker; } function scr_marker_fromasset(arg0, arg1 = depth, arg2 = false) { if (is_undefined(arg0)) { debug_message("Warning: scr_marker_fromasset() sprite_instance didn't exist"); return -4; } var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var imagespeed = layer_sprite_get_speed(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var thismarker = instance_create_depth(xloc, yloc, arg1, obj_marker); with (thismarker) { sprite_index = sprite; image_index = index; image_speed = imagespeed; image_xscale = xscale; image_yscale = yscale; image_angle = angle; image_blend = blend; image_alpha = alpha; if (arg2)
scr_depth_alt(id, arg2);
} return thismarker; } function scr_assetgetinfo(arg0) { var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var imagespeed = layer_sprite_get_speed(arg0); return [sprite, index, xloc, yloc, xscale, yscale, angle, blend, alpha, imagespeed]; }
(0, 0, spr_pxwhite, room_width, room_height, undefined, undefined, c_black, 102);
348
            }
349
            if (timer == (delay + 8 + jumptime + 10))
350
            {
351
                with (whiteout)
352
                {
353
                    
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);
354
                    
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);
355
                }
356
            }
357
            if (timer == (delay + 8 + jumptime + 55))
358
                room_goto(room_dw_churchc_titanclimb2_post);
359
        }
360
    }
361
}
362
var overlapping_trigger = instance_place(x, y, obj_climb_destructableclimbarea);
363
if (overlapping_trigger != -4)
364
{
365
    with (overlapping_trigger)
366
    {
367
        if (con == 0)
368
            con = 1;
369
    }
370
}