Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_musicalslide_Step_2

(view raw script w/o annotations or w/e)
1
sweettimer++;
2
if (sweetcon == 0)
3
{
4
    sweet = instance_create(768, cameray(), obj_marker);
5
    sweet.sprite_index = spr_sweet_dance;
6
    sweet.image_speed = 0.25;
7
    sweet.image_xscale = 2;
8
    sweet.image_yscale = 2;
9
    table = instance_create(768, cameray(), obj_marker);
10
    table.sprite_index = spr_cutscene_cyber01_dj_table_hover;
11
    table.image_speed = 0.25;
12
    table.image_xscale = 2;
13
    table.image_yscale = 2;
14
    sweetcon = -1;
15
}
16
if (sweetcon == 1)
17
{
18
    if (sweet.x > 541)
19
    {
20
        sweet.x = lerp(sweet.x, 540, 0.1);
21
    }
22
    else
23
    {
24
        sweet.x = 540;
25
        sweetcon = 2;
26
    }
27
}
28
if (i_ex(sweet))
29
{
30
    if (fadingOut == 0)
31
        sweet.y = (cameray() + 20) - (sin(sweettimer / 8) * 6);
32
    else
33
        sweet.y = lerp(sweet.y, -128, 0.125);
34
}
35
table.x = sweet.x - 54;
36
table.y = sweet.y + 58;
37
if (state == 0)
38
{
39
    if (instance_exists(obj_mainchara) && obj_mainchara.y > gameIntroY)
40
    {
41
        with (obj_mainchara)
42
        {
43
            sprite_index = spr_krisd_slide;
44
            fun = 1;
45
            autorun = 2;
46
            cutscene = 1;
47
            battlemode = 1;
48
        }
49
        if (instance_exists(obj_caterpillarchara))
50
        {
51
            with (obj_caterpillarchara)
52
            {
53
                if (name == "susie")
54
                {
55
                    other.susX = x;
56
                    other.susY = y;
57
                    visible = false;
58
                }
59
                if (name == "ralsei")
60
                {
61
                    other.ralX = x;
62
                    other.ralY = y;
63
                    visible = false;
64
                }
65
            }
66
        }
67
        slideSus = instance_create(susX, susY, obj_marker);
68
        slideRal = instance_create(ralX, ralY, obj_marker);
69
        with (slideSus)
70
        {
71
            con = 0;
72
            sprite_index = spr_susie_slide;
73
            image_xscale = 2;
74
            image_yscale = 2;
75
            image_speed = 0.25;
76
            depth = 900000;
77
            timer = 0;
78
        }
79
        with (slideRal)
80
        {
81
            con = 0;
82
            sprite_index = spr_ralsei_slide;
83
            image_xscale = 2;
84
            image_yscale = 2;
85
            image_speed = 0.25;
86
            depth = 900000;
87
            timer = 0;
88
        }
89
        snd_play(snd_noise);
90
        slideSound = snd_loop(snd_paper_surf);
91
        alarm[1]
 = 1;
gml_Object_obj_musicalslide_Alarm_1.gml

dust = instance_create_depth(obj_mainchara.x + 20, obj_mainchara.y + 30, depth, obj_slidedust); with (dust) { vspeed = -6; hspeed = -1 + random(2); } alarm[1]
 = 4;
92
        state = 1;
93
        instance_create(0, 0, obj_battlealphaer);
94
    }
95
}
96
if (slideRal != 0)
97
{
98
    with (slideRal)
99
    {
100
        depth = 900000;
101
        if (con == 0)
102
        {
103
            desiredpoint = 210;
104
            if ((charaX() - 64 - 10) > desiredpoint)
105
                desiredpoint = charaX() - 64 - 10;
106
            
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; }
(desiredpoint, 148, 10);
107
            con++;
108
        }
109
        if (con == 1)
110
        {
111
            timer++;
112
            if (timer == 60)
113
                con++;
114
        }
115
        if (con == 2)
116
        {
117
            if (other.slideSus.con == 2)
118
            {
119
                other.slideSus.con = 3;
120
                con++;
121
            }
122
        }
123
        if (con == 3)
124
        {
125
            y += 8;
126
            image_alpha *= 0.99;
127
            if (y > (cameray() + 480 + 32))
128
                instance_destroy();
129
        }
130
        if (y > 360)
131
            image_alpha -= 0.1;
132
    }
133
}
134
if (slideSus != 0)
135
{
136
    with (slideSus)
137
    {
138
        depth = 900000;
139
        if (con == 0)
140
        {
141
            desiredpoint = 260;
142
            if (desiredpoint < (charaX() + 28 + 10))
143
                desiredpoint = charaX() + 28 + 10;
144
            desiredpoint = clamp(desiredpoint, 260, 390);
145
            
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; }
(desiredpoint, 148, 10);
146
            con++;
147
        }
148
        if (con == 1)
149
        {
150
            timer++;
151
            if (timer == 60)
152
                con++;
153
        }
154
        if (con == 2)
155
        {
156
        }
157
        if (con == 3)
158
        {
159
            y += 10;
160
            image_alpha *= 0.99;
161
            if (y > (cameray() + 480 + 32))
162
                instance_destroy();
163
        }
164
        if (y > 360)
165
            image_alpha -= 0.1;
166
    }
167
}
168
if (state > 0)
169
{
170
    if (i_ex(obj_cyber_wall_lights))
171
    {
172
        with (obj_cyber_wall_lights)
173
            y -= 10;
174
    }
175
    layer_y(tileLayer, layer_get_y(tileLayer) - slideSpeed);
176
    if (layer_get_y(tileLayer) < -960)
177
        layer_y(tileLayer, layer_get_y(tileLayer) + 480);
178
    layer_y(spriteLayer, layer_get_y(spriteLayer) - slideSpeed);
179
    if (layer_get_y(spriteLayer) < -960)
180
        layer_y(spriteLayer, layer_get_y(spriteLayer) + 480);
181
    with (obj_mainchara)
182
        x = max(x, 200);
183
}
184
if (state == 1)
185
{
186
    sweetcon = 1;
187
    lanesFadein = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(lanesFadein, 1, 1/30);
188
    if (lanesFadein >= 1)
189
        state = 2;
190
}
191
if (state == 2)
192
{
193
    lanesEndFadein = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(lanesEndFadein, 1, 1/15);
194
    if (lanesEndFadein == 1)
195
    {
196
        state = 3;
197
        snd_free(global.currentsong[0]);
198
        mus_initloop("cyber.ogg");
199
    }
200
}
201
if (state == 3)
202
{
203
    with (obj_mainchara)
204
    {
205
        sprite_index = spr_krisd_slide;
206
        autorun = 2;
207
    }
208
    var _camY = cameray();
209
    if (snd_is_playing(global.currentsong[1]))
210
        soundTimeStep = audio_sound_get_track_position(global.currentsong[1]);
211
    else
212
        soundTimeStep += bpf;
213
    beats = soundTimeStep / spb;
214
    if (floor(beats) > floor(beatsPrev))
215
    {
216
        beats = soundTimeStep / spb;
217
        flashAlpha = 1;
218
    }
219
    beatsPrev = beats;
220
    with (obj_slidebullet)
221
    {
222
        framesAway = (targetBeat - other.beats) / other.bpf;
223
        var _percent = max(0, framesAway / frames);
224
        y = _camY + ease_out_cubic(_percent, other.lanesEndY, -other.lanesEndY, 1);
225
        y = max(y, _camY + 10);
226
        if (active && !hit)
227
            event_user(0);
228
        yChange = y - _camY - lastY;
229
        lastY = y - _camY;
230
        if (image_alpha >= 1)
231
            active = 1;
232
        if (framesAway < (frames + fadeInSpeed))
233
            image_alpha = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(image_alpha, 1, 1 / fadeInSpeed);
234
        if (framesAway < frames)
235
        {
236
            if (_percent <= 0)
237
            {
238
                instance_destroy();
239
                other.bigFlash = 0.2;
240
            }
241
        }
242
    }
243
    flashAlpha *= 0.9;
244
    bigFlash *= 0.95;
245
    if (beats >= 32)
246
        fadingOut = true;
247
}
248
if (fadingOut)
249
{
250
    fadeToWhite = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(fadeToWhite, 1, 1/30);
251
    if (fadeToWhite == 1)
252
    {
253
        with (obj_mainchara)
254
            battlemode = 0;
255
        with (instance_create(0, 0, obj_persistentfadein))
256
            image_blend = c_white;
257
        global.interact = 3;
258
        global.entrance = 1;
259
        room_goto_next();
260
    }
261
}
262
depth = obj_mainchara.depth + 1;