Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_dw_church_pushableshelf_darklight_Step_0

(view raw script w/o annotations or w/e)
1
beginx = x;
2
beginy = y;
3
if (init == 0)
4
{
5
    upstairs[0] = instance_create(x + 0, y + 0, obj_solid_temp);
6
    upstairs[1] = instance_create(x + 40, y + 0, obj_solid_temp);
7
    upstairs[2] = instance_create(x + 80, y + 0, obj_solid_temp);
8
    upstairs[3] = instance_create(x + 0, y + 40, obj_solid_temp);
9
    upstairs[4] = instance_create(x + 40, y + 40, obj_solid_temp);
10
    upstairs[5] = instance_create(x + 80, y + 40, obj_solid_temp);
11
    upstairs[6] = instance_create(x + 0, y + 80, obj_solid_temp);
12
    upstairs[7] = instance_create(x + 40, y + 80, obj_solid_temp);
13
    upstairs[8] = instance_create(x + 80, y + 80, obj_solid_temp);
14
    for (var i = 0; i < array_length(upstairs); i++)
15
    {
16
        upstairs[i].extflag = "FLOOR2";
17
        upstairs[i].active = false;
18
    }
19
    if (config == 0)
20
    {
21
        upstairs[8].extflag = "inactive";
22
        upstairs[0].extflag = "inactive";
23
        upstairs[3].extflag = "inactive";
24
        upstairs[6].extflag = "inactive";
25
    }
26
    if (config == 1)
27
    {
28
        upstairs[0].extflag = "inactive";
29
        upstairs[3].extflag = "inactive";
30
        upstairs[1].extflag = "inactive";
31
        upstairs[4].extflag = "inactive";
32
        upstairs[7].extflag = "inactive";
33
    }
34
    if (config == 2)
35
    {
36
        upstairs[2].extflag = "inactive";
37
        upstairs[5].extflag = "inactive";
38
        upstairs[4].extflag = "inactive";
39
        upstairs[3].extflag = "inactive";
40
    }
41
    if (image_index == 0)
42
    {
43
    }
44
    if (image_index == 1)
45
    {
46
        ladder = instance_create(x + 40, (y + 120) - 4, obj_climbingarea);
47
        ladder.image_xscale = 1;
48
        ladder.image_yscale = 2;
49
        climbpoint = instance_create(x + 40, y + 120 + 2, obj_heightfloor_changer);
50
        myblock[0].image_xscale = 1;
51
        myblock[1] = instance_create(x + 80, y + 80, obj_solidblockDark);
52
        myblock[1].image_yscale = 3;
53
        myblock[2] = instance_create(x + 40, y + 80, obj_solidblockDark);
54
    }
55
    init = 1;
56
}
57
if (con == 1)
58
{
59
    if (mydir == 3)
60
    {
61
        for (var j = 1; j < maxDistance; j++)
62
        {
63
            for (var i = 0; i < array_length(myblock); i++)
64
            {
65
                myblock[i].x -= 40 * j;
66
                with (myblock[i])
67
                {
68
                    if (place_meeting(x, y, obj_solidblock) || place_meeting(x, y, obj_solidenemy))
69
                    {
70
                        var ignoreblock = 0;
71
                        var foundblock = instance_place(x, y, obj_solidblock);
72
                        if (foundblock == -4)
73
                            foundblock = instance_place(x, y, obj_solidenemy);
74
                        for (var b = 0; b < array_length(other.myblock); b++)
75
                        {
76
                            if (foundblock == other.myblock[b])
77
                                ignoreblock = 1;
78
                        }
79
                        if (ignoreblock == 0)
80
                        {
81
                            if (other.moveamount == 0 || j < other.moveamount)
82
                                other.moveamount = j;
83
                        }
84
                    }
85
                }
86
                myblock[i].x += 40 * j;
87
            }
88
        }
89
    }
90
    if (mydir == 1)
91
    {
92
        for (var j = 1; j < maxDistance; j++)
93
        {
94
            for (var i = 0; i < array_length(myblock); i++)
95
            {
96
                myblock[i].x += 40 * j;
97
                with (myblock[i])
98
                {
99
                    if (place_meeting(x, y, obj_solidblock) || place_meeting(x, y, obj_solidenemy))
100
                    {
101
                        var ignoreblock = 0;
102
                        var foundblock = instance_place(x, y, obj_solidblock);
103
                        if (foundblock == -4)
104
                            foundblock = instance_place(x, y, obj_solidenemy);
105
                        for (var b = 0; b < array_length(other.myblock); b++)
106
                        {
107
                            if (foundblock == other.myblock[b])
108
                                ignoreblock = 1;
109
                        }
110
                        if (ignoreblock == 0)
111
                        {
112
                            if (other.moveamount == 0 || j < other.moveamount)
113
                                other.moveamount = j;
114
                        }
115
                    }
116
                }
117
                myblock[i].x -= 40 * j;
118
            }
119
        }
120
    }
121
    if (mydir == 0)
122
    {
123
        for (var j = 1; j < maxDistance; j++)
124
        {
125
            for (var i = 0; i < array_length(myblock); i++)
126
            {
127
                myblock[i].y += 40 * j;
128
                with (myblock[i])
129
                {
130
                    if (place_meeting(x, y, obj_solidblock) || place_meeting(x, y, obj_solidenemy))
131
                    {
132
                        var ignoreblock = 0;
133
                        var foundblock = instance_place(x, y, obj_solidblock);
134
                        if (foundblock == -4)
135
                            foundblock = instance_place(x, y, obj_solidenemy);
136
                        for (var b = 0; b < array_length(other.myblock); b++)
137
                        {
138
                            if (foundblock == other.myblock[b])
139
                                ignoreblock = 1;
140
                        }
141
                        if (ignoreblock == 0)
142
                        {
143
                            if (other.moveamount == 0 || j < other.moveamount)
144
                                other.moveamount = j;
145
                        }
146
                    }
147
                }
148
                myblock[i].y -= 40 * j;
149
            }
150
        }
151
    }
152
    if (mydir == 2)
153
    {
154
        for (var j = 1; j < maxDistance; j++)
155
        {
156
            for (var i = 0; i < array_length(myblock); i++)
157
            {
158
                myblock[i].y -= 40 * j;
159
                with (myblock[i])
160
                {
161
                    if (place_meeting(x, y, obj_solidblock) || place_meeting(x, y, obj_solidenemy))
162
                    {
163
                        var ignoreblock = 0;
164
                        var foundblock = instance_place(x, y, obj_solidblock);
165
                        if (foundblock == -4)
166
                            foundblock = instance_place(x, y, obj_solidenemy);
167
                        for (var b = 0; b < array_length(other.myblock); b++)
168
                        {
169
                            if (foundblock == other.myblock[b])
170
                                ignoreblock = 1;
171
                        }
172
                        if (ignoreblock == 0)
173
                        {
174
                            if (other.moveamount == 0 || j < other.moveamount)
175
                                other.moveamount = j;
176
                        }
177
                    }
178
                }
179
                myblock[i].y += 40 * j;
180
            }
181
        }
182
    }
183
    con = 2;
184
}
185
if (con == 2)
186
{
187
    debug_message(moveamount);
188
    if (moveamount == 0)
189
    {
190
    }
191
    else
192
    {
193
        if (movetype == 1 && moveamount > 2)
194
            moveamount = 2;
195
        snd_play(snd_wing);
196
        timeend = moveamount * 3;
197
        if (mydir == 3)
198
            
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, x - (40 * (moveamount - 1)), timeend, 3, "in");
199
        if (mydir == 1)
200
            
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, x + (40 * (moveamount - 1)), timeend, 3, "in");
201
        if (mydir == 0)
202
            
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, y + (40 * (moveamount - 1)), timeend, 3, "in");
203
        if (mydir == 2)
204
            
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, y - (40 * (moveamount - 1)), timeend, 3, "in");
205
    }
206
    con = 3;
207
}
208
if (con == 3)
209
{
210
    timer++;
211
    if ((timer % 3) == 0 && timer < timeend)
212
        snd_play_pitch(snd_wing, 0.2 + ((timer / timeend) * 0.8));
213
    if (timer == timeend || moveamount == 0)
214
    {
215
        snd_play(snd_impact);
216
        global.interact = 0;
217
        timeend = 30;
218
        moveamount = 0;
219
        con = 0;
220
    }
221
}
222
var updatedepth = true;
223
if (i_ex(obj_dw_church_bookshelfpuzzle))
224
{
225
    if (obj_dw_church_bookshelfpuzzle.flooractive == 2)
226
    {
227
        updatedepth = false;
228
        
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
229
        depth += 10000;
230
    }
231
}
232
if (updatedepth)
233
    
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();