Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_tower_dog_controller_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    if (global.dogtowerskipintro == true)
4
    {
5
        with (obj_camera_clamper)
6
        {
7
            xmin = 120;
8
            xmax = 120;
9
        }
10
    }
11
}
12
if (con == 0 && obj_mainchara.y < 8640)
13
{
14
    con = 1;
15
    if (global.dogtowerskipintro == true)
16
        con = 3;
17
    global.interact = 1;
18
    global.facing = 0;
19
    cutscene_master = 
scr_cutscene_make
scr_cutscene_make

function
scr_cutscene_make()
{ _cutscene_master = instance_create(0, 0, obj_cutscene_master); _cutscene_master.master_object = id; return _cutscene_master; }
();
20
    
scr_maincharacters_actors
scr_maincharacters_actors

function
scr_maincharacters_actors()
{ actor_count = 0; kr = 0; kr_actor = instance_create(obj_mainchara.x, obj_mainchara.y, obj_actor);
scr_actor_setup(kr, kr_actor, "kris");
kr_actor.sprite_index = obj_mainchara.sprite_index; kr_actor.depth = obj_mainchara.depth; with (obj_mainchara) visible = 0; for (__jj = 0; __jj < array_length_1d(global.cinstance); __jj++) { if (i_ex(global.cinstance[__jj])) { if (global.cinstance[__jj].name == "susie") { actor_count++; su = __jj + 1; su_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor);
scr_actor_setup(su, su_actor, "susie");
su_actor.sprite_index = global.cinstance[__jj].sprite_index; su_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } if (global.cinstance[__jj].name == "ralsei") { actor_count++; ra = __jj + 1; ra_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor);
scr_actor_setup(ra, ra_actor, "ralsei");
ra_actor.sprite_index = global.cinstance[__jj].sprite_index; ra_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } if (global.cinstance[__jj].name == "noelle") { actor_count++; no = __jj + 1; no_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor);
scr_actor_setup(no, no_actor, "noelle");
no_actor.sprite_index = global.cinstance[__jj].sprite_index; no_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } } } }
();
21
}
22
if (con == 1)
23
{
24
    timer++;
25
    if (timer == 1)
26
    {
27
        startcamy = cameray();
28
        with (obj_tower_dog_ladder_fake)
29
            depth = obj_rotating_tower_controller_new.depth - 5;
30
        with (obj_rotating_bullet_new)
31
            visible = false;
32
        with (obj_camera_clamper)
33
        {
34
            
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; }
("xmin", 0, 120, 60);
35
            
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; }
("xmax", 0, 120, 60);
36
        }
37
    }
38
    var lerpval = -(cos((pi * timer) / 60) - 1) / 2;
39
    camerax_set(lerp(0, 120, lerpval));
40
    cameray_set(lerp(startcamy, 3800, lerpval));
41
    if (timer == 5)
42
    {
43
    }
44
    if (timer == 15)
45
    {
46
    }
47
    if (timer == 60)
48
    {
49
        timer = 0;
50
        con = 2;
51
    }
52
}
53
if (con == 2)
54
{
55
    timer++;
56
    if (timer == 1)
57
    {
58
    }
59
    if (timer == 2)
60
    {
61
    }
62
    if (timer >= 120)
63
    {
64
        var lerpval = -(cos((pi * (timer - 120)) / 40) - 1) / 2;
65
        cameray_set(lerp(3800, 8434, lerpval));
66
    }
67
    if (timer == 160)
68
    {
69
        timer = 0;
70
        con = 3;
71
        with (obj_rotating_tower_controller_new)
72
        {
73
        }
74
    }
75
}
76
if (con == 3)
77
{
78
    dog.hspeed = -2;
79
    if (global.dogtowerskipintro == true)
80
        dog.hspeed = -4;
81
    global.facing = 1;
82
    
scr_actor_facing
scr_actor_facing

function
scr_actor_facing(arg0, arg1)
{ __newfacing = arg1; arg0.facing = __newfacing; if (__newfacing == "d") arg0.sprite_index = arg0.dsprite; if (__newfacing == "r") arg0.sprite_index = arg0.rsprite; if (__newfacing == "l") arg0.sprite_index = arg0.lsprite; if (__newfacing == "u") arg0.sprite_index = arg0.usprite; }
(kr_actor, "r");
83
    if (dog.x <= 560)
84
    {
85
        dog.x = 560;
86
        dog.hspeed = 0;
87
        dog.image_speed = 0;
88
        con = 4;
89
    }
90
}
91
if (con == 4)
92
{
93
    timer++;
94
    if (global.dogtowerskipintro == true)
95
        timer = max(180, timer);
96
    if (timer == 60)
97
        letterboxcon = 1;
98
    if (timer == 210)
99
    {
100
        con = 5;
101
        timer = 0;
102
    }
103
}
104
if (con == 5)
105
{
106
    timer++;
107
    if (timer == 1)
108
    {
109
        layer_set_visible("TowerTop_Fake", false);
110
        snd_play(snd_jump);
111
        with (kr_actor)
112
        {
113
            
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; }
(296, 8440, 10, 25);
114
            sprite_index = spr_kris_jump_ball;
115
            image_speed = 1;
116
            walk = 0;
117
        }
118
        with (dog)
119
        {
120
            x -= 20;
121
            
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; }
(542, 8440, 10, 25);
122
            sprite_index = spr_dog_jump_ball;
123
            image_xscale = 1.5;
124
            image_yscale = 1.5;
125
            image_speed = 1;
126
        }
127
        
scr_pan_lerp
scr_pan_lerp

function
scr_pan_lerp(arg0, arg1, arg2, arg3 = -1)
{ panner = instance_create(arg0, arg1, obj_panner); panner.panmax = arg2; panner.type = 1; if (arg3 != -1) panner.locktype = arg3; }
(camerax(), 8238, 25);
128
    }
129
    if (timer == 28)
130
    {
131
        instance_create((kr_actor.x + 4) - 120, kr_actor.y + 20, obj_climb_kris);
132
        obj_mainchara.freeze = true;
133
        obj_mainchara.y = kr_actor.y;
134
        with (obj_rotating_bullet_new)
135
            visible = true;
136
        instance_create_depth(0, 0, depth - 10, obj_tower_dog);
137
        with (kr_actor)
138
            visible = false;
139
        with (dog)
140
            visible = false;
141
        con = 6;
142
        timer = 0;
143
        global.dogtowerskipintro = true;
144
        global.currentsong[0] = snd_init("mus_race.ogg");
145
        global.currentsong[1] = mus_loop_ext(global.currentsong[0], 0.7, 1);
146
        global.interact = 0;
147
        obj_rotating_tower_controller_new.tower_falls_apart_con = 1;
148
    }
149
}
150
if (con == 6)
151
{
152
    timer++;
153
    if (obj_rotating_tower_controller_new.endclimb)
154
    {
155
        if (dogcon < 0)
156
        {
157
            dogcon -= 1;
158
            if (dogcon == -80)
159
            {
160
                dogcon = 0;
161
                var moved_up;
162
                for (moved_up = 0; obj_climb_kris.y > 1500; moved_up += 40)
163
                {
164
                    obj_climb_kris.y -= 40;
165
                    obj_climb_kris._cameray -= 40;
166
                    obj_climb_kris.remy -= 40;
167
                    obj_tower_dog.draw_y -= 40;
168
                    with (obj_tower_dog_stilts2)
169
                        y -= 40;
170
                }
171
                cameray_set(cameray() - moved_up);
172
            }
173
        }
174
    }
175
    if (dogcon >= 0)
176
    {
177
        if (camlerpstarty == -1)
178
        {
179
            camlerpstarty = cameray();
180
            camlerpstartsub = obj_rotating_tower_controller_new.endclimbtimer;
181
        }
182
        cameray_set(lerp(camlerpstarty, 0, clamp((obj_rotating_tower_controller_new.endclimbtimer - camlerpstartsub) / 120, 0, 1)));
183
    }
184
    if (dogcon == 0 && i_ex(obj_tower_dog) && (obj_rotating_tower_controller_new.tower_ystart + 400) > obj_tower_dog.draw_y && obj_rotating_tower_controller_new.endclimb == true)
185
    {
186
        snd_play(snd_jump);
187
        with (dog)
188
        {
189
            visible = true;
190
            x = 320;
191
            y = obj_tower_dog.draw_y;
192
            x -= 20;
193
            sprite_index = spr_dog_jump_ball;
194
            image_xscale = 1.5;
195
            image_yscale = 1.5;
196
            image_speed = 1;
197
            
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; }
(306, 264, 10, 22);
198
        }
199
        with (obj_tower_dog)
200
            instance_destroy();
201
        dogcon = 1;
202
    }
203
    if (dogcon == 1)
204
    {
205
        dogtimer++;
206
        if (dogtimer == 25)
207
        {
208
            dogtimer = 0;
209
            dogcon = 2;
210
            snd_play(snd_bump);
211
            with (dog)
212
            {
213
                x += 18;
214
                y += 10;
215
                sprite_index = spr_dog_walk;
216
                image_xscale = -2;
217
                image_yscale = 2;
218
                image_speed = 0.16666666666666666;
219
            }
220
        }
221
    }
222
    if (dogcon == 2)
223
    {
224
        timer = -30;
225
        con = 7;
226
        snd_free(global.currentsong[0]);
227
    }
228
}
229
if (con == 7 && !i_ex(obj_cutscene_master))
230
{
231
    cameray_set(lerp(cameray(), 0, clamp((obj_rotating_tower_controller_new.endclimbtimer - 60) / 100, 0, 1)));
232
    timer++;
233
    if (timer == 0)
234
        global.interact = 1;
235
    if (timer == 60)
236
    {
237
        dog.hspeed = 2;
238
        dog.image_xscale = -2;
239
    }
240
    if (timer == 119)
241
        dog.hspeed = 0;
242
    if (timer == 201)
243
        dog.hspeed = -1;
244
    if (timer == 209)
245
    {
246
        dog.hspeed = 8;
247
        
scr_pan_lerp
scr_pan_lerp

function
scr_pan_lerp(arg0, arg1, arg2, arg3 = -1)
{ panner = instance_create(arg0, arg1, obj_panner); panner.panmax = arg2; panner.type = 1; if (arg3 != -1) panner.locktype = arg3; }
(camerax() + 220, cameray(), 60);
248
    }
249
    if (timer == 257)
250
    {
251
        dog.hspeed = 0;
252
        dog.image_xscale = 2;
253
    }
254
    if (timer == 278)
255
        dog.vspeed = -2;
256
    if (timer == 300)
257
    {
258
        dog.vspeed = 0;
259
        snd_play(snd_link_sfx_itemget);
260
        with (obj_tower_dog_bone)
261
        {
262
            
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, other.dog.x, 12, 2, "in");
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; }
("y", y, other.dog.y - 32, 12, 2, "out");
264
        }
265
        obj_mainchara.x = 296;
266
        obj_mainchara.y = 200;
267
        with (obj_mainchara)
268
        {
269
            visible = 1;
270
            depth = -99999999;
271
        }
272
        with (obj_climb_kris)
273
            instance_destroy();
274
        with (kr_actor)
275
            instance_destroy();
276
        global.facing = 1;
277
    }
278
    if (timer == 306)
279
        makestars = true;
280
    if (timer == 340)
281
    {
282
        with (obj_tower_dog_bone)
283
            instance_destroy();
284
    }
285
    if (timer == 390)
286
    {
287
        dog.hspeed = 2;
288
        dog.image_xscale = -2;
289
    }
290
    if (timer == 510)
291
    {
292
        with (dog)
293
            instance_destroy();
294
        
scr_pan_lerp
scr_pan_lerp

function
scr_pan_lerp(arg0, arg1, arg2, arg3 = -1)
{ panner = instance_create(arg0, arg1, obj_panner); panner.panmax = arg2; panner.type = 1; if (arg3 != -1) panner.locktype = arg3; }
(0, cameray(), 60);
295
    }
296
    if (timer == 570)
297
    {
298
        with (obj_mainchara)
299
alarm[1]
300
        obj_mainchara.cutscene = 0;
301
        obj_mainchara.freeze = 0;
302
        global.interact = 0;
303
        con = 99;
304
        
scr_flag_set
scr_flag_set

function
scr_flag_set(arg0, arg1)
{ global.flag[arg0] = arg1; if (
scr_debug())
show_debug_message("*** flag [" + string(arg0) + "] updated: " + string(arg1) + " | " + scr_flag_name_get(arg0)); } function scr_setflag(arg0, arg1) {
scr_flag_set(arg0, arg1);
}
(1642, 1);
305
        
scr_tempsave
scr_tempsave

function
scr_tempsave()
{ filechoicebk2 = global.filechoice; global.filechoice = 9;
scr_saveprocess(global.filechoice);
global.filechoice = filechoicebk2; }
();
306
    }
307
}
308
with (obj_mainchara)
309
{
310
    if (other.con < 6 && other.con > 0)
311
        cutscene = 1;
312
}
313
if (makestars == true)
314
{
315
    makestarstimer++;
316
    if ((makestarstimer % 2) == 0)
317
    {
318
        var star = instance_create(obj_tower_dog_bone.x, obj_tower_dog_bone.y, obj_marker);
319
        with (star)
320
        {
321
            sprite_index = spr_board_star_8px;
322
            direction = other.makestarstimer * 20;
323
            speed = 5;
324
            friction = 0.25;
325
            image_index = irandom(3);
326
            image_xscale = 2;
327
            image_yscale = 2;
328
            depth = obj_tower_dog_bone.depth + 1;
329
            image_speed = 0;
330
            
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, random_range(13, 16));
331
        }
332
        star = instance_create(obj_tower_dog_bone.x, obj_tower_dog_bone.y, obj_marker);
333
        with (star)
334
        {
335
            sprite_index = spr_board_star_8px;
336
            direction = (other.makestarstimer * 20) + 180;
337
            speed = 5;
338
            friction = 0.25;
339
            image_index = irandom(3);
340
            image_xscale = 2;
341
            image_yscale = 2;
342
            depth = obj_tower_dog_bone.depth + 1;
343
            image_speed = 0;
344
            
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, random_range(13, 16));
345
        }
346
    }
347
    if (makestarstimer >= 16)
348
        makestars = false;
349
}