Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_kitchen_Step_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(obj_homealone_heart))
2
    exit;
3
if (!init)
4
{
5
    init = true;
6
    vent_cover_marker.depth = obj_homealone_heart.depth - 10;
7
    vent_panel_marker.depth = obj_homealone_heart.depth - 10;
8
}
9
if (!drink_finished && !grab_heart)
10
{
11
    drink_make_timer++;
12
    if (drink_make_timer == 60)
13
    {
14
        snd_play(snd_wing);
15
        with (kris_marker)
16
            image_index = 1;
17
    }
18
    if (drink_make_timer == 64)
19
    {
20
        with (kris_marker)
21
            image_index = 2;
22
    }
23
    if (drink_make_timer == 68)
24
    {
25
        snd_loop(snd_paper_surf);
26
        with (kris_marker)
27
        {
28
            sprite_index = spr_noellehouse_kitchen_kris_drink_make;
29
            image_index = 0;
30
            image_speed = 0.2;
31
        }
32
    }
33
    if (drink_make_timer == (60 + drink_start_pause))
34
    {
35
        snd_stop(snd_paper_surf);
36
        with (kris_marker)
37
        {
38
            image_speed = 0;
39
            image_index = 0;
40
            sprite_index = spr_noellehouse_kitchen_kris_choco_put_down;
41
            
scr_animate
scr_animate

function
scr_animate(arg0, arg1, arg2)
{ __animator = instance_create(x, y, obj_animator); __animator.target = id; __animator.initframe = arg0; __animator.endframe = arg1; __animator.fake_image_speed = arg2; return __animator; }
(671, 2, 0.15);
42
        }
43
    }
44
    if (drink_make_timer == (64 + drink_start_pause))
45
        snd_play(snd_wing);
46
    if (drink_make_timer == (90 + drink_start_pause))
47
    {
48
        choco_marker.visible = 1;
49
        with (kris_marker)
50
        {
51
            sprite_index = spr_noellehouse_kitchen_kris_drink_take;
52
            image_speed = 0;
53
            image_index = 0;
54
        }
55
    }
56
    if (drink_make_timer == (94 + drink_start_pause))
57
    {
58
        with (kris_marker)
59
        {
60
            sprite_index = spr_noellehouse_kitchen_kris_drink_hold;
61
            image_speed = 0;
62
            image_index = 0;
63
        }
64
    }
65
    if (drink_make_timer == (98 + drink_start_pause))
66
    {
67
        snd_play(snd_swallow);
68
        with (kris_marker)
69
        {
70
            sprite_index = spr_noellehouse_kitchen_kris_drinking;
71
            image_speed = 0;
72
            image_index = 0;
73
        }
74
    }
75
    if (drink_make_timer == (162 + drink_start_pause))
76
    {
77
        drink_track = true;
78
        snd_play(snd_swallow);
79
        with (kris_marker)
80
        {
81
            sprite_index = spr_noellehouse_kitchen_kris_drink_left;
82
            image_speed = 0;
83
            image_index = 0;
84
        }
85
    }
86
    if (drink_make_timer == (220 + drink_start_pause))
87
    {
88
        snd_play(snd_swallow);
89
        with (kris_marker)
90
        {
91
            sprite_index = (sprite_index == spr_noellehouse_kitchen_kris_drink_left) ? spr_noellehouse_kitchen_kris_drink_finish_left : spr_noellehouse_kitchen_kris_drink_finish_right;
92
            image_index = 0;
93
        }
94
    }
95
    if (drink_make_timer == (280 + drink_start_pause))
96
    {
97
        drink_track = false;
98
        snd_play(snd_wing);
99
        with (kris_marker)
100
            sprite_index = spr_noellehouse_kitchen_kris_drink_hold_empty;
101
    }
102
    if (drink_make_timer == (320 + drink_start_pause))
103
    {
104
        with (kris_marker)
105
        {
106
            sprite_index = spr_noellehouse_kitchen_kris_drink_put_down;
107
            image_speed = 0;
108
            image_index = 0;
109
        }
110
    }
111
    if (drink_make_timer == (326 + drink_start_pause))
112
    {
113
        with (kris_marker)
114
            image_index = 1;
115
    }
116
    if (drink_make_timer == (336 + drink_start_pause))
117
    {
118
        snd_play_x(snd_wing, 0.5, 1.15);
119
        with (kris_marker)
120
            image_index = 2;
121
    }
122
    if (drink_make_timer == (342 + drink_start_pause))
123
    {
124
        with (kris_marker)
125
            image_index = 3;
126
    }
127
    if (drink_make_timer == (400 + drink_start_pause))
128
    {
129
        with (kris_marker)
130
            sprite_index = spr_noellehouse_kitchen_kris_look_phone;
131
        cup_marker.visible = 1;
132
        kris_drink_down = true;
133
        piano_sequence = 
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; } function scr_flag_name_get(arg0) { if (!global.is_console) { var v = global.flagname[arg0]; return is_undefined(v) ? "*unknown flag*" : v; } else { return ""; } } function scr_getflag(arg0) { return
scr_flag_get(arg0);
}
(737) > 0;
134
        drink_finished = 
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; } function scr_flag_name_get(arg0) { if (!global.is_console) { var v = global.flagname[arg0]; return is_undefined(v) ? "*unknown flag*" : v; } else { return ""; } } function scr_getflag(arg0) { return
scr_flag_get(arg0);
}
(737) > 0;
135
    }
136
    if (drink_make_timer == (500 + drink_start_pause))
137
    {
138
        with (kris_marker)
139
        {
140
            sprite_index = spr_noellehouse_kitchen_kris_sleep;
141
            image_index = 0;
142
        }
143
    }
144
    if (drink_make_timer == (1100 + drink_start_pause))
145
    {
146
        with (kris_marker)
147
            image_index = 1;
148
    }
149
    if (drink_make_timer == (1700 + drink_start_pause))
150
    {
151
        with (kris_marker)
152
            image_index = 2;
153
    }
154
    if (drink_make_timer == (2300 + drink_start_pause))
155
    {
156
        snd_play(snd_noise);
157
        with (kris_marker)
158
        {
159
            image_index = 3;
160
            
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); }
();
161
        }
162
    }
163
    if (drink_make_timer == (2400 + drink_start_pause))
164
        drink_finished = true;
165
}
166
if (
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; } function scr_flag_name_get(arg0) { if (!global.is_console) { var v = global.flagname[arg0]; return is_undefined(v) ? "*unknown flag*" : v; } else { return ""; } } function scr_getflag(arg0) { return
scr_flag_get(arg0);
}
(737) == 0)
167
{
168
    if (kris_throw)
169
    {
170
        kris_throw_timer++;
171
        if (!kris_drink_down)
172
        {
173
            if (kris_throw_timer == 1)
174
            {
175
                drink_finished = true;
176
                if (kris_marker.sprite_index == spr_noellehouse_kitchen_kris_drink_put_down)
177
                {
178
                    with (kris_marker)
179
                    {
180
                        image_index = 1;
181
                        image_speed = 0;
182
                    }
183
                    cup_marker.visible = 1;
184
                    kris_drink_down = true;
185
                    kris_throw_timer = 0;
186
                    exit;
187
                }
188
                with (kris_marker)
189
                {
190
                    snd_play(snd_noise);
191
                    sprite_index = spr_noellehouse_kitchen_kris_drink_hold_empty;
192
                }
193
            }
194
            if (kris_throw_timer == 4)
195
            {
196
                with (kris_marker)
197
                {
198
                    sprite_index = spr_noellehouse_kitchen_kris_drink_put_down;
199
                    
scr_animate
scr_animate

function
scr_animate(arg0, arg1, arg2)
{ __animator = instance_create(x, y, obj_animator); __animator.target = id; __animator.initframe = arg0; __animator.endframe = arg1; __animator.fake_image_speed = arg2; return __animator; }
(4796, 1, 0.5);
200
                }
201
            }
202
            if (kris_throw_timer == 10)
203
            {
204
                snd_play(snd_bump);
205
                cup_marker.visible = 1;
206
                kris_drink_down = true;
207
                kris_throw_timer = 0;
208
            }
209
        }
210
        else
211
        {
212
            if (kris_throw_timer == 1)
213
            {
214
                with (choco_marker)
215
                    throw_choco = true;
216
            }
217
            if (kris_throw_timer == 2)
218
            {
219
                snd_play(snd_grab);
220
                with (kris_marker)
221
                {
222
                    sprite_index = spr_noellehouse_kitchen_kris_throw;
223
                    image_speed = 0;
224
                    image_index = 0;
225
                }
226
            }
227
            if (kris_throw_timer == 3)
228
            {
229
                with (kris_marker)
230
                    image_index = 1;
231
            }
232
            if (kris_throw_timer == 4)
233
            {
234
                kris_throw = false;
235
                with (kris_marker)
236
                    image_index = 2;
237
            }
238
        }
239
    }
240
    if (!is_noticed && !grab_heart && !kris_throw && !finished)
241
    {
242
        if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, 150, 75, 170, 80))
243
        {
244
            sink_notice_timer--;
245
            if (sink_marker.visible == 0)
246
                sink_marker.visible = 1;
247
            if (sink_notice_timer <= 0)
248
                is_noticed = true;
249
        }
250
        if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, 160 + room_offset_x, 80 + room_offset_y, 300 + room_offset_x, 200 + room_offset_y))
251
            is_noticed = true;
252
    }
253
    if (is_noticed)
254
    {
255
        notice_timer++;
256
        if (!finished)
257
        {
258
            var zone_type = 0;
259
            if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, 160 + room_offset_x, 80 + room_offset_y, 300 + room_offset_x, 200 + room_offset_y))
260
                zone_type = 1;
261
            if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, throw_threshold_x_a, throw_threshold_y_a, throw_threshold_xx_a, throw_threshold_yy_a))
262
                zone_type = 1;
263
            if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, throw_threshold_x_b, throw_threshold_y_b, throw_threshold_xx_b, throw_threshold_yy_b))
264
                zone_type = 1;
265
            if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, 205 + room_offset_x, 80 + room_offset_y, (235 + room_offset_x) - 10, (130 + room_offset_y) - 20))
266
                zone_type = 2;
267
            if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, 160 + room_offset_x, 95 + room_offset_y, (235 + room_offset_x) - 10, (130 + room_offset_y) - 20))
268
                zone_type = 3;
269
            if (zone_type == 0)
270
            {
271
                choco_marker.visible = 1;
272
                finished = true;
273
                kris_throw = true;
274
                is_noticed = false;
275
                with (obj_homealone_kitchen_phone)
276
                    stop_speech = true;
277
                exit;
278
            }
279
            else if (kris_drink_down)
280
            {
281
                if (zone_type > 1)
282
                {
283
                    drink_finished = true;
284
                    finished = true;
285
                    is_noticed = false;
286
                    with (obj_homealone_kitchen_phone)
287
                        stop_speech = true;
288
                    grab_heart = true;
289
                    exit;
290
                }
291
                else if (obj_homealone_heart.y >= 190)
292
                {
293
                    choco_marker.visible = 1;
294
                    finished = true;
295
                    kris_throw = true;
296
                    is_noticed = false;
297
                    with (obj_homealone_kitchen_phone)
298
                        stop_speech = true;
299
                    exit;
300
                }
301
            }
302
            else if (drink_track)
303
            {
304
                if (obj_homealone_heart.x > kris_turn_pos && kris_face_left)
305
                {
306
                    kris_face_left = false;
307
                    with (kris_marker)
308
                    {
309
                        if (sprite_index == spr_noellehouse_kitchen_kris_drink_left)
310
                            sprite_index = spr_noellehouse_kitchen_kris_drink_right;
311
                        else if (sprite_index == spr_noellehouse_kitchen_kris_drink_finish_left)
312
                            sprite_index = spr_noellehouse_kitchen_kris_drink_finish_right;
313
                    }
314
                }
315
                if (obj_homealone_heart.x < kris_turn_pos && !kris_face_left)
316
                {
317
                    kris_face_left = true;
318
                    with (kris_marker)
319
                    {
320
                        if (sprite_index == spr_noellehouse_kitchen_kris_drink_right)
321
                            sprite_index = spr_noellehouse_kitchen_kris_drink_left;
322
                        else if (sprite_index == spr_noellehouse_kitchen_kris_drink_finish_right)
323
                            sprite_index = spr_noellehouse_kitchen_kris_drink_finish_left;
324
                    }
325
                }
326
            }
327
        }
328
    }
329
    if (grab_heart)
330
    {
331
        grab_heart_timer++;
332
        var take = false;
333
        var turn_pos = kris_turn_pos;
334
        if (grab_heart_timer == 1)
335
        {
336
            global.interact = 1;
337
            kris_marker.sprite_index = ((obj_homealone_heart.x - 20) > kris_marker.x) ? spr_noellehouse_kitchen_kris_jump_catch_right : spr_noellehouse_kitchen_kris_jump_catch;
338
            kris_marker.image_index = 0;
339
            kris_marker.depth = 100000;
340
            obj_homealone_heart.depth = kris_marker.depth + 10;
341
            with (kris_marker)
342
                
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; }
(obj_homealone_heart.x - 20, obj_homealone_heart.y, 15, 8);
343
        }
344
        if (grab_heart_timer == 6)
345
            kris_marker.image_index = 1;
346
        if (grab_heart_timer == 7)
347
        {
348
            snd_play(snd_grab);
349
            snd_play(snd_hurt1);
350
            with (obj_homealone_heart)
351
                visible = 0;
352
        }
353
        if (grab_heart_timer == 10)
354
        {
355
            kris_marker.image_index = 2;
356
            with (kris_marker)
357
                
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); }
();
358
            heart_take = true;
359
            grab_heart = false;
360
            drink_finished = true;
361
        }
362
    }
363
    if (hit_heart && !kris_get)
364
    {
365
        heart_fall_timer++;
366
        if (heart_fall_timer == 1)
367
        {
368
            global.interact = 1;
369
            heart_fall_ypos = obj_homealone_heart.y;
370
            with (obj_homealone_heart)
371
            {
372
                cutscene = 1;
373
                if (x >= 255)
374
                    image_angle -= 45;
375
                else
376
                    image_angle += 45;
377
                
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); }
();
378
            }
379
        }
380
        if (heart_fall_timer == 4)
381
        {
382
            with (obj_homealone_heart)
383
            {
384
                if (x >= 255 && x < 555)
385
                {
386
                    gravity = 0.5;
387
                    hspeed = 2;
388
                    friction = 0.1;
389
                }
390
                else if (x >= 515)
391
                {
392
                    gravity = 0.5;
393
                    friction = 0.1;
394
                }
395
                else
396
                {
397
                    gravity = 0.5;
398
                    hspeed = -2;
399
                    friction = 0.1;
400
                }
401
            }
402
        }
403
        if (heart_fall_timer >= 4)
404
        {
405
            var start_ypos = heart_fall_ypos;
406
            var get = false;
407
            with (obj_homealone_heart)
408
            {
409
                var stop_ypos = 200;
410
                if (start_ypos < 130 && x < 270)
411
                    stop_ypos = 130;
412
                if (x > 555)
413
                    stop_ypos = 140;
414
                if (y >= stop_ypos)
415
                {
416
                    snd_play(snd_noise);
417
                    snd_play(snd_hurt1);
418
                    gravity = 0;
419
                    vspeed = 0;
420
                    get = true;
421
                    if (x >= 555)
422
                    {
423
                        with (obj_homealone_heart)
424
                            
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; }
(525, 200, 5, 10);
425
                    }
426
                    else if (image_angle < 0 && y > 190)
427
                    {
428
                        y -= 4;
429
                    }
430
                }
431
            }
432
            kris_get = get;
433
            hit_heart = !kris_get;
434
        }
435
    }
436
    if (kris_get)
437
    {
438
        kris_get_timer++;
439
        if (kris_get_timer == 60)
440
        {
441
            with (kris_marker)
442
            {
443
                sprite_index = spr_noellehouse_kitchen_kris_chase_dl;
444
                image_speed = 0.25;
445
                image_index = 0;
446
                
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
447
                if (y < ((obj_homealone_heart.y - sprite_height) + 2))
448
                    sprite_index = spr_noellehouse_kitchen_kris_chase_ul;
449
                else if (x < obj_homealone_heart.x)
450
                    sprite_index = spr_noellehouse_kitchen_kris_chase_dr;
451
            }
452
            move_towards_heart = true;
453
            kris_get = false;
454
            kris_get_timer = 0;
455
        }
456
    }
457
    if (move_towards_heart)
458
    {
459
        move_timer++;
460
        if (move_timer == 1)
461
        {
462
            snd_play(snd_noise);
463
            
scr_script_repeat
scr_script_repeat

function
scr_script_repeat()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = -2; __scriptdelay.max_time = argument[1]; __scriptdelay.rate = argument[2]; __scriptdelay.constant = 1; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 3); __i++) __scriptdelay.script_arg[__i] = argument[__i + 3]; __scriptdelay.arg_count = argument_count - 3; return __scriptdelay; }
(snd_play, 150, 6, 348);
464
            
scr_script_repeat
scr_script_repeat

function
scr_script_repeat()
{ var __scriptdelay = instance_create(0, 0, obj_script_delayed); __scriptdelay.script = argument[0]; __scriptdelay.alarm[0] = -2; __scriptdelay.max_time = argument[1]; __scriptdelay.rate = argument[2]; __scriptdelay.constant = 1; __scriptdelay.target = id; for (var __i = 0; __i < (argument_count - 3); __i++) __scriptdelay.script_arg[__i] = argument[__i + 3]; __scriptdelay.arg_count = argument_count - 3; return __scriptdelay; }
(snd_play, 150, 12, 349);
465
            obj_homealone_heart.depth = kris_marker.depth + 1000;
466
            move_up = obj_homealone_heart.y < 134;
467
            move_right = obj_homealone_heart.y >= 150 && obj_homealone_heart.x > 154;
468
        }
469
        if (move_timer >= 1)
470
        {
471
            if (obj_homealone_heart.x < 275 && obj_homealone_heart.y < 150)
472
            {
473
                var take = false;
474
                var turn_pos = kris_turn_pos;
475
                with (kris_marker)
476
                {
477
                    obj_homealone_heart.depth = depth + 1000;
478
                    sprite_index = spr_noellehouse_kitchen_kris_chase_ul;
479
                    if (obj_homealone_heart.x < turn_pos)
480
                    {
481
                        if (x != (obj_homealone_heart.x - 8) || y != (obj_homealone_heart.y - sprite_height))
482
                        {
483
                            scr_obj_movetowards_obj(568, 10, -8, -sprite_height);
484
                        }
485
                        else
486
                        {
487
                            global.interact = 1;
488
                            take = true;
489
                        }
490
                    }
491
                    else if (x != (obj_homealone_heart.x - 30) || y != (obj_homealone_heart.y - sprite_height))
492
                    {
493
                        scr_obj_movetowards_obj(568, 10, -30, -sprite_height);
494
                    }
495
                    else
496
                    {
497
                        global.interact = 1;
498
                        take = true;
499
                    }
500
                }
501
                heart_take = take;
502
                move_towards_heart = !heart_take;
503
            }
504
            else
505
            {
506
                var first_xpos = (obj_homealone_heart.x < 154) ? 147 : 125;
507
                var target_ypos = obj_homealone_heart.y - kris_marker.sprite_height;
508
                if (obj_homealone_heart.image_angle < 0)
509
                    target_ypos += 6;
510
                if (!heart_aligned)
511
                {
512
                    if (kris_marker.x != first_xpos)
513
                    {
514
                        kris_marker.sprite_index = spr_noellehouse_kitchen_kris_chase_dl;
515
                        with (kris_marker)
516
                            x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, first_xpos, 6);
517
                    }
518
                    else if (kris_marker.y != target_ypos)
519
                    {
520
                        if (move_up && kris_marker.sprite_index != spr_noellehouse_kitchen_kris_chase_ul)
521
                            kris_marker.sprite_index = spr_noellehouse_kitchen_kris_chase_ul;
522
                        with (kris_marker)
523
                        {
524
                            if (y >= 160)
525
                                depth = 97000;
526
                            y = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(y, target_ypos, 6);
527
                        }
528
                    }
529
                    else
530
                    {
531
                        heart_aligned = true;
532
                    }
533
                }
534
                else
535
                {
536
                    obj_homealone_heart.depth = kris_marker.depth + 1000;
537
                    var take = false;
538
                    if (move_right)
539
                    {
540
                        if (kris_marker.sprite_index != spr_noellehouse_kitchen_kris_chase_dr)
541
                            kris_marker.sprite_index = spr_noellehouse_kitchen_kris_chase_dr;
542
                        if (kris_marker.x != (obj_homealone_heart.x - 30))
543
                        {
544
                            with (kris_marker)
545
                                x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, obj_homealone_heart.x - 30, 6);
546
                        }
547
                        else
548
                        {
549
                            take = true;
550
                        }
551
                    }
552
                    else if (kris_marker.x != (obj_homealone_heart.x - 8))
553
                    {
554
                        with (kris_marker)
555
                            x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, obj_homealone_heart.x - 8, 6);
556
                    }
557
                    else
558
                    {
559
                        take = true;
560
                    }
561
                    heart_take = take;
562
                    move_towards_heart = !heart_take;
563
                }
564
            }
565
        }
566
    }
567
    if (heart_take)
568
    {
569
        kris_get = false;
570
        hit_heart = false;
571
        var pause = 42;
572
        heart_take_timer++;
573
        if (heart_take_timer == 1)
574
        {
575
            
scr_script_repeat_stop
scr_script_repeat_stop

function
scr_script_repeat_stop()
{ var _myid = id; with (obj_script_delayed) { if (target == _myid) { max_time = -300; alarm[0] instance_destroy(); } } }
();
576
            snd_play(snd_noise);
577
            with (kris_marker)
578
            {
579
                image_speed = 0;
580
                var flip = false;
581
                if (sprite_index == spr_noellehouse_kitchen_kris_chase_ur || sprite_index == spr_noellehouse_kitchen_kris_chase_dr || sprite_index == spr_noellehouse_kitchen_kris_jump_catch_right)
582
                    flip = true;
583
                sprite_index = spr_noellehouse_kitchen_kris_grab_lean;
584
                if (flip)
585
                {
586
                    
scr_flip
scr_flip

function
scr_flip(arg0)
{ if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
587
                    x += 8;
588
                }
589
                
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); }
();
590
            }
591
        }
592
        if (heart_take_timer == (4 + pause))
593
        {
594
            with (obj_homealone_heart)
595
                visible = 0;
596
            snd_play(snd_grab);
597
            with (kris_marker)
598
            {
599
                sprite_index = spr_noellehouse_kitchen_kris_grab_hold;
600
                
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); }
();
601
            }
602
        }
603
        if (heart_take_timer == (4 + pause + 60))
604
        {
605
            with (kris_marker)
606
            {
607
                sprite_index = spr_noellehouse_kitchen_kris_turn;
608
                image_index = 0;
609
                image_speed = 0;
610
            }
611
        }
612
        if (heart_take_timer == (4 + pause + 60 + 10))
613
        {
614
            with (kris_marker)
615
                image_index = 1;
616
        }
617
        if (heart_take_timer == (4 + pause + 60 + 10 + 10))
618
        {
619
            with (kris_marker)
620
                image_index = 2;
621
        }
622
        if (heart_take_timer == (4 + pause + 60 + 10 + 10 + 10))
623
        {
624
            with (kris_marker)
625
                image_index = 3;
626
        }
627
        if (heart_take_timer == (4 + pause + 60 + 10 + 10 + 10 + 10))
628
        {
629
            with (kris_marker)
630
                image_index = 4;
631
        }
632
        if (heart_take_timer >= (4 + pause + 60 + 10 + 10 + 10 + 10 + 30))
633
            screen_dark = true;
634
        if (heart_take_timer >= (4 + pause + 60 + 10 + 10 + 10 + 10 + 10 + 30 + 30))
635
        {
636
            heart_take = false;
637
            
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);
}
(737, 1);
638
            global.interact = 3;
639
            global.entrance = 11;
640
            room_goto(room_lw_noellehouse_main);
641
            instance_create(0, 0, obj_persistentfadein);
642
        }
643
    }
644
    if (debug_reset)
645
    {
646
        debug_reset_timer++;
647
        if (debug_reset_timer >= 120)
648
        {
649
            debug_reset_timer = 0;
650
            debug_reset = false;
651
            heart_fall_timer = 0;
652
            notice_timer = 0;
653
            hit_heart = false;
654
            is_noticed = false;
655
            grab_heart = false;
656
            finished = false;
657
            kris_get = false;
658
            kris_get_timer = 0;
659
            move_towards_heart = false;
660
            heart_take = false;
661
            heart_take_timer = 0;
662
            move_timer = 0;
663
            walk_speed = 2;
664
            kris_face_left = false;
665
            if (move_right)
666
            {
667
                with (kris_marker)
668
                    
scr_flip
scr_flip

function
scr_flip(arg0)
{ if (arg0 == "h" || arg0 == "x") { x += ((sprite_get_width(sprite_index) - (sprite_get_xoffset(sprite_index) * 2)) * image_xscale); image_xscale = -image_xscale; } else { y += ((sprite_get_height(sprite_index) - (sprite_get_yoffset(sprite_index) * 2)) * image_yscale); image_yscale = -image_yscale; } }
("x");
669
            }
670
            heart_aligned = false;
671
            move_up = false;
672
            move_right = false;
673
            global.interact = 0;
674
            with (obj_homealone_heart)
675
            {
676
                cutscene = 0;
677
                x = 120;
678
                y = 120;
679
                depth = 6000;
680
                image_angle = 0;
681
                gravity = 0;
682
                vspeed = 0;
683
                hspeed = 0;
684
                friction = 0;
685
                visible = 1;
686
            }
687
            with (choco_marker)
688
            {
689
                bounce_timer = 0;
690
                bounce = false;
691
                x = 244;
692
                y = 156;
693
                depth = 70000;
694
                visible = 0;
695
                image_angle = 0;
696
                gravity = 0;
697
                vspeed = 0;
698
                hspeed = 0;
699
                friction = 0;
700
                is_thrown = false;
701
                with (bounce_bottle)
702
                    instance_destroy();
703
            }
704
            drink_finished = false;
705
            drink_make_timer = 0;
706
            drink_track = false;
707
            cup_marker.visible = 0;
708
            kris_throw = false;
709
            kris_throw_timer = 0;
710
            kris_drink_down = false;
711
            kris_marker.depth = depth == 98000;
712
            kris_marker.x = 237;
713
            kris_marker.y = 129;
714
            kris_marker.image_xscale = 1;
715
            kris_marker.sprite_index = spr_noellehouse_kitchen_kris_choco_start_make;
716
            kris_marker.image_index = 0;
717
            kris_marker.image_speed = 0;
718
            screen_dark = false;
719
        }
720
    }
721
}
722
if (piano_sequence)
723
{
724
    if (drink_finished && !piano_play)
725
    {
726
        piano_pause_timer++;
727
        if (piano_pause_timer < 90)
728
            exit;
729
        if (!piano_aligned)
730
        {
731
            if (kris_marker.x != 140)
732
            {
733
                with (kris_marker)
734
                {
735
                    
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
736
                    if (sprite_index != spr_krisl)
737
                    {
738
                        
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);
}
(787, 2);
739
                        sprite_index = spr_krisl;
740
                        x += 15;
741
                        image_speed = 0.15;
742
                    }
743
                    else
744
                    {
745
                        x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, 140, 1);
746
                    }
747
                }
748
            }
749
            else if (kris_marker.y != 170)
750
            {
751
                with (kris_marker)
752
                {
753
                    if (sprite_index != spr_krisd)
754
                    {
755
                        
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);
}
(787, 3);
756
                        sprite_index = spr_krisd;
757
                    }
758
                    depth = 97000;
759
                    y = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(y, 170, 1);
760
                }
761
            }
762
            else
763
            {
764
                piano_aligned = true;
765
            }
766
        }
767
        else
768
        {
769
            var play = false;
770
            if (kris_marker.sprite_index != spr_krisr)
771
            {
772
                
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);
}
(787, 4);
773
                kris_marker.sprite_index = spr_krisr;
774
            }
775
            if (kris_marker.x != 460)
776
            {
777
                with (kris_marker)
778
                    x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(x, 460, 1);
779
            }
780
            else
781
            {
782
                play = true;
783
            }
784
            piano_play = play;
785
        }
786
    }
787
    if (piano_play && 
scr_flag_get
scr_flag_get

function
scr_flag_get(arg0)
{ var flag_value = global.flag[arg0]; return flag_value; } function scr_flag_name_get(arg0) { if (!global.is_console) { var v = global.flagname[arg0]; return is_undefined(v) ? "*unknown flag*" : v; } else { return ""; } } function scr_getflag(arg0) { return
scr_flag_get(arg0);
}
(738) < 8)
788
    {
789
        piano_timer++;
790
        if (piano_timer == 30)
791
        {
792
            
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);
}
(738, piano_index + 1);
793
            var piano_track = piano_playlist[piano_index] + ".ogg";
794
            piano_song[0] = snd_init(piano_track);
795
            audio_emitter_position(emitter, -400, 0, 0);
796
            piano_song[1] = audio_play_sound_on(emitter, piano_song[0], false, 0);
797
            piano_time = (audio_sound_length(piano_song[1]) * 30) - 30;
798
        }
799
        if (piano_timer >= (30 + piano_time))
800
        {
801
            if (audio_exists(piano_song[0]))
802
            {
803
                if (audio_is_playing(piano_song[0]))
804
                    snd_free(piano_song[0]);
805
            }
806
            piano_index++;
807
            if (piano_index > (array_length_1d(piano_playlist) - 1))
808
            {
809
                
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);
}
(738, 9);
810
                piano_play = false;
811
            }
812
            else
813
            {
814
                piano_timer = 0;
815
            }
816
        }
817
    }
818
}