Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_movingBookshelf_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    i_ex(obj_mainchara);
4
    if (obj_mainchara.x > x)
5
        x = rightx;
6
    alarm[2]
 = 1;
gml_Object_obj_movingBookshelf_Alarm_2.gml

mycam = instance_create(x, y, obj_camera_advanced); with (mycam) { cameraActive = 0; ignoreFreeze = 1; panStyle[0] = 1; targetObject[0] = 1049; targetObjectCenter[0] = 1; targetXRelative[0] = 0; targetYRelative[0] = 0; } if (botY == 0) botY = room_height - sprite_height - 20; init = 2;
7
    init = 1;
8
}
9
if (init == 2)
10
{
11
    
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
12
    if (ralsei == 0)
13
    {
14
        with (obj_caterpillarchara)
15
        {
16
            if (name == "ralsei")
17
                other.ralsei = id;
18
        }
19
    }
20
    if (susie == 0)
21
    {
22
        with (obj_caterpillarchara)
23
        {
24
            if (name == "susie")
25
                other.susie = id;
26
        }
27
    }
28
    if (krl == 0)
29
    {
30
        with (obj_bookshelfLanding)
31
        {
32
            if (image_index == 0 && myride == other.myride && x < other.x)
33
                other.krl = id;
34
        }
35
    }
36
    if (krr == 0)
37
    {
38
        with (obj_bookshelfLanding)
39
        {
40
            if (image_index == 0 && myride == other.myride && x > other.x)
41
                other.krr = id;
42
        }
43
    }
44
    if (susl == 0)
45
    {
46
        with (obj_bookshelfLanding)
47
        {
48
            if (image_index == 1 && myride == other.myride && x < other.x)
49
                other.susl = id;
50
        }
51
    }
52
    if (susr == 0)
53
    {
54
        with (obj_bookshelfLanding)
55
        {
56
            if (image_index == 1 && myride == other.myride && x > other.x)
57
                other.susr = id;
58
        }
59
    }
60
    if (rall == 0)
61
    {
62
        with (obj_bookshelfLanding)
63
        {
64
            if (image_index == 2 && myride == other.myride && x < other.x)
65
                other.rall = id;
66
        }
67
    }
68
    if (ralr == 0)
69
    {
70
        with (obj_bookshelfLanding)
71
        {
72
            if (image_index == 2 && myride == other.myride && x > other.x)
73
                other.ralr = id;
74
        }
75
    }
76
    if (engaged == 1)
77
    {
78
        depth = 800000;
79
        if (con == 0)
80
        {
81
            global.flag[7 disable_menu?] = 1;
82
            global.interact = 1;
83
            depth += 10000;
84
            timer++;
85
            if (timer == 1)
86
            {
87
                snd_play(snd_jump);
88
                obj_mainchara.fun = 1;
89
                obj_mainchara.image_speed = 0.25;
90
                obj_mainchara.sprite_index = krisball;
91
                with (obj_mainchara)
92
                    
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
((other.x + (other.sprite_width / 2)) - 20, (other.y + (other.sprite_height / 2)) - 26, 8, 15);
93
                if (susie != 0)
94
                {
95
                    with (susie)
96
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.x + (other.sprite_width / 2) + 18, (other.y + (other.sprite_height / 2)) - 38, 8, 15);
97
                    susie.fun = 1;
98
                    susie.sprite_index = susieball;
99
                    susie.image_speed = 0.25;
100
                }
101
                if (ralsei != 0)
102
                {
103
                    with (ralsei)
104
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
((other.x + (other.sprite_width / 2)) - 62, (other.y + (other.sprite_height / 2)) - 36, 8, 15);
105
                    ralsei.fun = 1;
106
                    ralsei.sprite_index = ralseiball;
107
                    ralsei.image_speed = 0.25;
108
                }
109
            }
110
            if (timer == 16)
111
            {
112
                timer = 0;
113
                con = 1;
114
                global.interact = 0;
115
            }
116
        }
117
        if (con == 1)
118
        {
119
            with (obj_mainchara)
120
            {
121
                battlemode = 1;
122
                battlealpha = 0;
123
            }
124
            riding = true;
125
            maxspeed = 18;
126
            if (going == "left" && abs(hspeed) < maxspeed)
127
                hspeed--;
128
            if (going == "right" && abs(hspeed) < maxspeed)
129
                hspeed++;
130
            hspeed = clamp(hspeed, -maxspeed, maxspeed);
131
            if (up_h() && !down_h())
132
                vspeed--;
133
            if (down_h() && !up_h())
134
                vspeed++;
135
            if ((!up_h() && !down_h()) || (up_h() && down_h()))
136
            {
137
                if (vspeed > 0)
138
                    vspeed--;
139
                if (vspeed < 0)
140
                    vspeed++;
141
            }
142
            maxvspeed = 8;
143
            vspeed = clamp(vspeed, -maxvspeed, maxvspeed);
144
            y = clamp(y, topY, botY);
145
            if (x >= rightx && going == "right")
146
            {
147
                x = rightx;
148
                with (obj_mainchara)
149
                    
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.krr.x, other.krr.y, 8, 15);
150
                if (susie != 0)
151
                {
152
                    with (susie)
153
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.susr.x, other.susr.y, 8, 15);
154
                }
155
                if (ralsei != 0)
156
                {
157
                    with (ralsei)
158
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.ralr.x, other.ralr.y, 8, 15);
159
                }
160
                con = 1.5;
161
            }
162
            if (x <= leftx && going == "left")
163
            {
164
                x = leftx;
165
                with (obj_mainchara)
166
                    
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.krl.x, other.krl.y, 8, 15);
167
                if (susie != 0)
168
                {
169
                    with (susie)
170
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.susl.x, other.susl.y, 8, 15);
171
                }
172
                if (ralsei != 0)
173
                {
174
                    with (ralsei)
175
                        
scr_jump_to_point
scr_jump_to_point

function
scr_jump_to_point(arg0, arg1, arg2, arg3, arg4 = 0)
{ var ___jump =
scr_jump_to_point_sprite(arg0, arg1, arg2, arg3, 0, 0);
with (___jump) { trackalpha = arg4; trackblend = arg4; trackindex = arg4; tracksprite = arg4; trackangle = arg4; } return ___jump; }
(other.rall.x, other.rall.y, 8, 15);
176
                }
177
                con = 1.5;
178
            }
179
            if (place_meeting(x, y, obj_overworldbulletparent))
180
            {
181
                var perp = instance_place(x, y, obj_overworldbulletparent);
182
                if (perp.active == 1)
183
                {
184
                    vspeed = 0;
185
                    hspeed *= 0.2;
186
                    with (perp)
187
                    {
188
                        if (global.inv < 0)
189
                            event_user(5);
190
                        active = 2;
191
                    }
192
                }
193
            }
194
        }
195
        if (con == 1.5)
196
        {
197
            snd_play(snd_jump);
198
            global.interact = 1;
199
            hspeed = 0;
200
            vspeed = 0;
201
            snd_play(snd_locker);
202
            con = 2;
203
            timer = 0;
204
            riding = false;
205
            with (obj_darkcontroller)
206
                charcon = 0;
207
            obj_mainchara.fun = 1;
208
            obj_mainchara.image_speed = 0.25;
209
            obj_mainchara.sprite_index = krisball;
210
            if (susie != 0)
211
            {
212
                susie.sprite_index = susieball;
213
                susie.image_speed = 0.25;
214
                susie.ignoredepth = 0;
215
            }
216
            if (ralsei != 0)
217
            {
218
                susie.image_speed = 0.25;
219
                ralsei.sprite_index = ralseiball;
220
                ralsei.ignoredepth = 0;
221
            }
222
        }
223
        if (con == 2)
224
        {
225
            depth += 10000;
226
            timer++;
227
            if (timer == 12)
228
                panactive = 0;
229
            if (timer == 17)
230
            {
231
                obj_mainchara.fun = 0;
232
                with (obj_mainchara)
233
                    battlemode = 0;
234
                with (obj_caterpillarchara)
235
                {
236
                    fun = 0;
237
                    follow = 1;
238
                    
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate(arg0 = "none")
{ if (arg0 == "all") { with (obj_caterpillarchara) scr_caterpillar_interpolate_old(); } else if (arg0 == "none") { if (object_index == obj_caterpillarchara) scr_caterpillar_interpolate_old(); } else { with (obj_caterpillarchara) { if (name == arg0) scr_caterpillar_interpolate_old(); } } } function scr_caterinterp(arg0 = "none") {
scr_caterpillar_interpolate(arg0);
} function scr_caterpillar_interpolate_old() { _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
239
                }
240
                vspeed = 0;
241
                
scr_move_to_point_over_time
scr_move_to_point_over_time

function
scr_move_to_point_over_time(arg0, arg1, arg2)
{ _mmm = instance_create(x, y, obj_move_to_point); _mmm.target = id; _mmm.movex = arg0; _mmm.movey = arg1; _mmm.movemax = arg2; return _mmm; }
(x, ystart, 15);
242
                engaged = 0;
243
                global.facing = 0;
244
                global.interact = 0;
245
                global.flag[7 disable_menu?] = 0;
246
                timer = 0;
247
                con = 0;
248
            }
249
        }
250
    }
251
    if (panactive == 1)
252
    {
253
        pan = lerp(pan, pantarg, 0.1);
254
        if (going == "right")
255
            pantarg = 200;
256
        if (going == "left")
257
            pantarg = -200;
258
        mycam.targetXRelative[0] = pan;
259
    }
260
    else
261
    {
262
        pantarg = 0;
263
        pan = lerp(pan, pantarg, 0.25);
264
        mycam.targetXRelative[0] = pan;
265
    }
266
}