Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_pushable_lancer_Step_0

(view raw script w/o annotations or w/e)
1
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
2
if (instance_exists(obj_slidedust))
3
{
4
    with (obj_slidedust)
5
        gravity = -1;
6
}
7
if (movecourse == 1)
8
{
9
    if (movedir == 0 || movedir == 2)
10
        movetimer = movetimetarget;
11
    if (movedir == 1)
12
    {
13
        x += 2;
14
        movetimetarget = 20;
15
        if ((movetimer % 4) == 1)
16
        {
17
            dust = instance_create(x + 16, y + sprite_height, obj_slidedust);
18
            dust.depth = depth + 10;
19
        }
20
    }
21
    if (movedir == 1 && x >= 2018)
22
    {
23
        movetimer = movetimetarget;
24
        x = 2018;
25
        snd_play(snd_noise);
26
    }
27
    if (movedir == 3)
28
    {
29
        if (x > 1070)
30
        {
31
            x -= 2;
32
            movetimetarget = 20;
33
            if ((movetimer % 4) == 1)
34
            {
35
                dust = instance_create((x + sprite_width) - 6, y + sprite_height, obj_slidedust);
36
                dust.depth = depth + 10;
37
            }
38
        }
39
        else
40
        {
41
            x -= 1;
42
            y += 0.5;
43
            movetimetarget = 40;
44
            if ((movetimer % 8) == 1)
45
            {
46
                dust = instance_create((x + sprite_width) - 6, y + sprite_height, obj_slidedust);
47
                dust.depth = depth + 10;
48
            }
49
        }
50
    }
51
    movetimer += 1;
52
    if (movetimer >= movetimetarget)
53
    {
54
        movetimer = 0;
55
        movecourse = 0;
56
        if (x <= 1038)
57
        {
58
            global.interact = 1;
59
            x = 1038;
60
            instance_create(x, y, obj_shake);
61
            snd_play(snd_locker);
62
            con = 1;
63
            timer = 0;
64
            visible = false;
65
            interactablelancer = instance_create(1036, 258, obj_npc_room);
66
            interactablelancer.sprite_index = spr_cutscene_20_lancer_stone_lt;
67
            interactablelancer.image_speed = 0;
68
            interactablelancer.image_index = 0;
69
        }
70
        else
71
        {
72
            global.interact = 0;
73
        }
74
    }
75
}
76
if (con == 1)
77
{
78
    timer++;
79
    if (timer == 60)
80
        con = 2;
81
}
82
if (myinteract == 3)
83
{
84
    if (i_ex(mydialoguer) == false)
85
    {
86
        global.interact = 0;
87
        myinteract = 0;
88
        with (obj_mainchara)
89
            onebuffer = 5;
90
    }
91
}
92
if (con == 2)
93
{
94
    global.interact = 1;
95
    sprite_index = spr_cutscene_20_lancer_stone_lt;
96
    if (spawnplate == 0)
97
    {
98
        spawnplate = 1;
99
        plate = instance_create(1004, -36, obj_marker);
100
        plate.visible = true;
101
        plate.direction = 270;
102
        plate.speed = 12;
103
        plate.image_xscale = 2;
104
        plate.image_yscale = 2;
105
        plate.image_angle = 15;
106
        plate.sprite_index = spr_plate;
107
    }
108
    with (plate)
109
        
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
110
    if (plate.y >= 286)
111
    {
112
        snd_play(snd_item);
113
        plate.y = 294;
114
        plate.speed = 0;
115
        plate.image_angle = 0;
116
        plate.direction = 0;
117
        con = 3;
118
    }
119
}
120
if (con == 3)
121
{
122
    if (spawnfood == 0)
123
    {
124
        spawnfood = 1;
125
        food = instance_create(1018, -28, obj_marker);
126
        with (food)
127
        {
128
            visible = true;
129
            direction = 270;
130
            speed = 12;
131
            image_xscale = 2;
132
            image_yscale = 2;
133
            image_angle = -15;
134
            sprite_index = spr_food;
135
            depth = other.plate.depth - 10;
136
        }
137
    }
138
    food.image_angle -= 12;
139
    if (food.y >= 294)
140
    {
141
        snd_play(snd_splat);
142
        food.y = 302;
143
        food.image_angle = 0;
144
        food.speed = 0;
145
        food.direction = 0;
146
        con = 4;
147
    }
148
}
149
if (con == 4)
150
{
151
    if (spawnbib == 0)
152
    {
153
        spawnbib = 1;
154
        bib = instance_create(interactablelancer.x + 20 + 16, -36, obj_marker);
155
        with (bib)
156
        {
157
            visible = true;
158
            direction = 270;
159
            speed = 12;
160
            image_xscale = 2;
161
            image_yscale = 2;
162
            image_angle = 150;
163
            sprite_index = spr_bib;
164
        }
165
    }
166
    bib.image_angle += 8;
167
    bib.depth = interactablelancer.depth - 50;
168
    if (bib.y >= 288)
169
    {
170
        with (bib)
171
            instance_destroy();
172
        interactablelancer.sprite_index = spr_cutscene_20_lancer_stone_bib;
173
        global.flag[356 lancer_cared_for] = 1;
174
        global.interact = 0;
175
        snd_play(snd_equip);
176
        instance_destroy();
177
    }
178
}