Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ch2_room_mansion_east_2f_a_Step_0

(view raw script w/o annotations or w/e)
1
if (global.flag[344 solved_saucer_puzzle?] == 0)
2
{
3
    if (key != -1)
4
    {
5
        with (key)
6
            scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
7
        doorlocked.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] = instance_create(key.x + 50, key.y + 30, obj_afterimage);
54
                sparkle[i].fadeSpeed = 0.01;
55
                scr_darksize
scr_darksize

function scr_darksize(arg0) { inst = arg0; inst.image_xscale = 2; inst.image_yscale = 2; }
(sparkle[i]);
56
                sparkle[i].sprite_index = spr_sparestar_anim;
57
                sparkle[i].image_speed = 0.5;
58
                sparkle[i].hspeed = random_range(-3, 3);
59
                sparkle[i].friction = 0.05;
60
                sparkle[i].gravity = 0.1;
61
            }
62
        }
63
    }
64
    if (keyfloat)
65
    {
66
        key.x = lerp(key.x, doorlocked.x, 0.1);
67
        key.y = lerp(key.y, doorlocked.y + 50, 0.1);
68
        if (key.x <= (doorlocked.x + 1) && key.y <= (doorlocked.y + 51))
69
        {
70
            con = 3;
71
            keysparkle = false;
72
        }
73
    }
74
    if (con == 3)
75
    {
76
        con = -1;
77
        global.interact = 0;
78
        global.flag[344 solved_saucer_puzzle?] = 1;
79
        explosion = instance_create(doorlocked.x + 50, doorlocked.y + 30, obj_animation);
80
        explosion.sprite_index = spr_realisticexplosion;
81
        explosion.image_xscale = 2;
82
        explosion.image_yscale = 2;
83
        dooropen = 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; }
(180, 40, spr_dw_mansion_door_open);
84
        dooropen.depth = 899999;
85
        fadeplatters = false;
86
        snd_play(snd_badexplosion);
87
        instance_destroy(key);
88
        instance_destroy(exitcollider);
89
        instance_destroy(doorlocked);
90
        for (var i = 0; i < array_length_1d(sparkle); i++)
91
        {
92
            with (sparkle[i])
93
                instance_destroy();
94
        }
95
        with (obj_saucer_monty)
96
            instance_destroy();
97
        with (obj_saucer)
98
        {
99
            if (x < 520)
100
            {
101
                instance_destroy(collider);
102
                instance_destroy();
103
            }
104
        }
105
        with (forcefield)
106
            instance_destroy();
107
        instance_destroy();
108
    }
109
    if (make_forcefield)
110
    {
111
        forcefield = 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; }
(410, 235, 2, 8, 1, 0);
112
        forcefield.depth = 80000;
113
        make_forcefield = false;
114
    }
115
}