Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_dw_church_pushableshelf_Step_0

(view raw script w/o annotations or w/e)
1
beginx = x;
2
beginy = y;
3
if (init == 0)
4
{
5
    if (image_index == 0)
6
    {
7
        myblock[0] = instance_create(x, y + 160, obj_solidblockDark);
8
        myblock[1] = instance_create(x, y + 120, obj_solidblockDark);
9
        myblock[1].image_xscale = 3;
10
        myblock[2] = instance_create(x + 80, y + 80, obj_solidblockDark);
11
        marker[0] = 
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; }
(x, y + 40, spr_dw_church_pushableshelf_nshelf_pt1);
12
        marker[1] = 
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; }
(x + 40, y, spr_dw_church_pushableshelf_nshelf_pt2);
13
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
(marker[0]);
14
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
(marker[1]);
15
        upstairs[0] = instance_create(x + 80, y + 0, obj_heightfloor);
16
        upstairs[1] = instance_create(x + 0, y + 40, obj_heightfloor);
17
        upstairs[1].image_xscale = 3;
18
        upstairs[2] = instance_create(x + 0, y + 80, obj_heightfloor);
19
    }
20
    if (image_index == 1)
21
    {
22
        myblock[0] = instance_create(x, y + 80, obj_solidblockDark);
23
        myblock[0].image_xscale = 3;
24
        myblock[0].image_yscale = 3;
25
        upstairs[0] = instance_create(x, y, obj_heightfloor);
26
        upstairs[0].image_xscale = 3;
27
        upstairs[1] = instance_create(x + 80, y + 40, obj_heightfloor);
28
        upstairs[2] = instance_create(x, y + 80, obj_heightfloor);
29
        upstairs[2].image_xscale = 3;
30
    }
31
    if (image_index == 2)
32
    {
33
        marker[0] = 
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; }
(x, y, spr_dw_church_pushableshelf_tshelf_pt1);
34
        marker[1] = 
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; }
(x + 40, y + 40, spr_dw_church_pushableshelf_tshelf_pt2);
35
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
(marker[0]);
36
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
(marker[1]);
37
        myblock[0] = instance_create(x, y + 80, obj_solidblockDark);
38
        myblock[0].image_yscale = 3;
39
        myblock[1] = instance_create(x + 40, y + 120, obj_solidblockDark);
40
        myblock[1].image_yscale = 1;
41
        upstairs[0] = instance_create(x + 0, y + 0, obj_heightfloor);
42
        upstairs[0].image_yscale = 3;
43
        upstairs[1] = instance_create(x + 40, y + 40, obj_heightfloor);
44
    }
45
    if (image_index == 3)
46
    {
47
        myblock[0] = instance_create(x, y + 80, obj_solidblockDark);
48
        myblock[0].image_xscale = 3;
49
        myblock[0].image_yscale = 1;
50
        sprite_index = spr_movingBookshelf;
51
        image_index = 0;
52
        upstairs[0] = instance_create(x + 0, y + 0, obj_heightfloor);
53
        upstairs[0].image_xscale = 3;
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))
69
                    {
70
                        var ignoreblock = 0;
71
                        var foundblock = instance_place(x, y, obj_solidblock);
72
                        for (var b = 0; b < array_length(other.myblock); b++)
73
                        {
74
                            if (foundblock == other.myblock[b])
75
                                ignoreblock = 1;
76
                        }
77
                        if (ignoreblock == 0)
78
                        {
79
                            if (other.moveamount == 0 || j < other.moveamount)
80
                                other.moveamount = j;
81
                        }
82
                    }
83
                }
84
                myblock[i].x += 40 * j;
85
            }
86
        }
87
    }
88
    if (mydir == 1)
89
    {
90
        for (var j = 1; j < maxDistance; j++)
91
        {
92
            for (var i = 0; i < array_length(myblock); i++)
93
            {
94
                myblock[i].x += 40 * j;
95
                with (myblock[i])
96
                {
97
                    if (place_meeting(x, y, obj_solidblock))
98
                    {
99
                        var ignoreblock = 0;
100
                        var foundblock = instance_place(x, y, obj_solidblock);
101
                        for (var b = 0; b < array_length(other.myblock); b++)
102
                        {
103
                            if (foundblock == other.myblock[b])
104
                                ignoreblock = 1;
105
                        }
106
                        if (ignoreblock == 0)
107
                        {
108
                            if (other.moveamount == 0 || j < other.moveamount)
109
                                other.moveamount = j;
110
                        }
111
                    }
112
                }
113
                myblock[i].x -= 40 * j;
114
            }
115
        }
116
    }
117
    if (mydir == 0)
118
    {
119
        for (var j = 1; j < maxDistance; j++)
120
        {
121
            for (var i = 0; i < array_length(myblock); i++)
122
            {
123
                myblock[i].y += 40 * j;
124
                with (myblock[i])
125
                {
126
                    if (place_meeting(x, y, obj_solidblock))
127
                    {
128
                        var ignoreblock = 0;
129
                        var foundblock = instance_place(x, y, obj_solidblock);
130
                        for (var b = 0; b < array_length(other.myblock); b++)
131
                        {
132
                            if (foundblock == other.myblock[b])
133
                                ignoreblock = 1;
134
                        }
135
                        if (ignoreblock == 0)
136
                        {
137
                            if (other.moveamount == 0 || j < other.moveamount)
138
                                other.moveamount = j;
139
                        }
140
                    }
141
                }
142
                myblock[i].y -= 40 * j;
143
            }
144
        }
145
    }
146
    if (mydir == 2)
147
    {
148
        for (var j = 1; j < maxDistance; j++)
149
        {
150
            for (var i = 0; i < array_length(myblock); i++)
151
            {
152
                myblock[i].y -= 40 * j;
153
                with (myblock[i])
154
                {
155
                    if (place_meeting(x, y, obj_solidblock))
156
                    {
157
                        var ignoreblock = 0;
158
                        var foundblock = instance_place(x, y, obj_solidblock);
159
                        for (var b = 0; b < array_length(other.myblock); b++)
160
                        {
161
                            if (foundblock == other.myblock[b])
162
                                ignoreblock = 1;
163
                        }
164
                        if (ignoreblock == 0)
165
                        {
166
                            if (other.moveamount == 0 || j < other.moveamount)
167
                                other.moveamount = j;
168
                        }
169
                    }
170
                }
171
                myblock[i].y += 40 * j;
172
            }
173
        }
174
    }
175
    con = 2;
176
}
177
if (con == 2)
178
{
179
    debug_message(moveamount);
180
    if (moveamount == 0)
181
    {
182
    }
183
    else
184
    {
185
        snd_play(snd_wing);
186
        timeend = moveamount * 3;
187
        if (mydir == 3)
188
            
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");
189
        if (mydir == 1)
190
            
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");
191
        if (mydir == 0)
192
            
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");
193
        if (mydir == 2)
194
            
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");
195
    }
196
    con = 3;
197
}
198
if (con == 3)
199
{
200
    timer++;
201
    if ((timer % 3) == 0 && timer < timeend)
202
        snd_play_pitch(snd_wing, 0.2 + ((timer / timeend) * 0.8));
203
    if (timer == timeend || moveamount == 0)
204
    {
205
        snd_play(snd_impact);
206
        global.interact = 0;
207
        timeend = 30;
208
        moveamount = 0;
209
        con = 0;
210
    }
211
}
212
scr_depth
scr_depth

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