Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ch2_room_mansion_2f_shortcut_Step_0

(view raw script w/o annotations or w/e)
1
if (global.flag[346 solved_saucer_shortcut] == 0)
2
{
3
    if (i_ex(key))
4
    {
5
        with (key)
6
            
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
7
        bookcase.depth = key.depth + 10;
8
    }
9
    if (con == 1)
10
    {
11
        con = 2;
12
        global.interact = 1;
13
        key = 
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; }
(keyXPos, keyYPos, spr_ch2_gimmick_saucer_key);
14
        fadeplatters = true;
15
    }
16
    if (fadeplatters)
17
    {
18
        with (obj_saucer)
19
        {
20
            if (x < 520)
21
            {
22
                if (image_alpha > 0)
23
                    image_alpha = lerp(image_alpha, 0, 0.2);
24
            }
25
        }
26
    }
27
    if (con == 2 && !keyfloat)
28
    {
29
        keysparkle = true;
30
        if (key.y != (keyYPos - 20))
31
        {
32
            key.y = lerp(key.y, keyYPos - 20, 0.1);
33
            if (key.y < (keyYPos - 18))
34
                key.y = keyYPos - 20;
35
        }
36
        else
37
        {
38
            floattimer++;
39
            if (floattimer == 30)
40
            {
41
                floattimer = 0;
42
                keyfloat = true;
43
            }
44
        }
45
    }
46
    if (keysparkle)
47
    {
48
        sparkletimer++;
49
        if ((sparkletimer % 4) == 0)
50
        {
51
            for (var i = 0; i < 1; i++)
52
            {
53
                sparkle[i] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(key.x + 50, key.y + 30, spr_sparestar_anim);
54
                sparkle[i].image_speed = 0.5;
55
                sparkle[i].hspeed = random_range(-3, 3);
56
                sparkle[i].friction = 0.05;
57
                sparkle[i].gravity = 0.1;
58
            }
59
        }
60
    }
61
    if (keyfloat)
62
    {
63
        key.x = lerp(key.x, bookcase.x, 0.1);
64
        key.y = lerp(key.y, bookcase.y + 50, 0.1);
65
        if (key.x <= (bookcase.x + 1) && key.y <= (bookcase.y + 51))
66
        {
67
            con = 3;
68
            keysparkle = false;
69
        }
70
    }
71
    if (con == 3)
72
    {
73
        con = -1;
74
        global.interact = 0;
75
        global.flag[346 solved_saucer_shortcut] = 1;
76
        explosion = instance_create(bookcase.x + 50, bookcase.y + 30, obj_animation);
77
        explosion.sprite_index = spr_realisticexplosion;
78
        explosion.image_xscale = 2;
79
        explosion.image_yscale = 2;
80
        fadeplatters = false;
81
        snd_play(snd_badexplosion);
82
        safe_delete(key);
83
        safe_delete(bookcase);
84
        for (var i = 0; i < array_length_1d(sparkle); i++)
85
        {
86
            with (sparkle[i])
87
                instance_destroy();
88
        }
89
        with (obj_saucer_monty)
90
            instance_destroy();
91
        with (obj_saucer)
92
        {
93
            if (x < 520)
94
            {
95
                instance_destroy(collider);
96
                instance_destroy();
97
            }
98
        }
99
        safe_delete(forcefield_right);
100
        instance_destroy();
101
    }
102
    if (make_forcefield)
103
    {
104
        if (!i_ex(obj_forcefield))
105
        {
106
            forcefield_right = 
scr_forcefield
scr_forcefield

function
scr_forcefield(arg0, arg1, arg2, arg3, arg4, arg5)
{ field = instance_create(arg0, arg1, obj_forcefield); field.image_xscale = arg2; field.image_yscale = arg3; field.skip = arg4; field.stayVisible = arg5; with (field)
scr_depth();
return field; }
(520, 240, 2, 8, 1, 0);
107
            forcefield_right.depth = 80000;
108
        }
109
        make_forcefield = false;
110
    }
111
}