Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_final_forme_Step_0

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_sneo_final_forme_hitbox))
2
    instance_create(x, y, obj_sneo_final_forme_hitbox);
3
if (intro == 1)
4
    exit;
5
formtimer++;
6
if (grazed == 1)
7
{
8
    grazetimer += 1;
9
    if (grazetimer >= 30)
10
    {
11
        grazetimer = 0;
12
        grazed = 0;
13
    }
14
}
15
if (state < 2)
16
{
17
    if (state == 0)
18
        stepdir = -1;
19
    if (state == 0 && formtimer >= 25)
20
        steptimer += 0.05;
21
    if (steptimer >= pi)
22
    {
23
        if (state == 0 && formtimer < 25)
24
        {
25
        }
26
        steptimer -= pi;
27
        d = instance_exists(obj_shake) ? 196 : instance_create(0, 0, obj_shake);
28
        d.shakex = ceil(2);
29
        d.shakey = ceil(2);
30
        snd_play(snd_screenshake);
31
        if (state == 1)
32
            stepdir = 1;
33
    }
34
    if (state == 11 && formtimer >= 65)
35
    {
36
    }
37
    else
38
    {
39
        y = ystart - (sin(steptimer) * 40);
40
    }
41
    if (state == 0 && formtimer < 25)
42
    {
43
    }
44
    else
45
    {
46
        x += (1.6 * stepdir);
47
    }
48
    if ((destroyable && state == 0 && x > (obj_growtangle.x + 140)) || (state == 1 && formtimer < 30 && x > (obj_growtangle.x + 140)))
49
    {
50
        x += (4 * stepdir);
51
        pushback = 0;
52
    }
53
    if (destroyable)
54
    {
55
        var _box = obj_sneo_warped_box;
56
        _box.suckx = min(obj_growtangle.x + 150, x + 106);
57
        _box.timer = scr_movetowards
scr_movetowards

function scr_movetowards(arg0, arg1, arg2) { if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); }
(_box.timer, clamp(scr_inverselerp
scr_inverselerp

function scr_inverselerp(arg0, arg1, arg2) { if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); }
(520, obj_growtangle.x + 100, x), 0, 1) * 60, 2);
58
        _box.upper_sucky = y + 129;
59
        _box.lower_sucky = y + 159;
60
    }
61
    if (pushback > 0)
62
    {
63
        x += (pushback * (2/3));
64
        if (x > (camerax() + 520))
65
            pushback--;
66
        else
67
            pushback--;
68
    }
69
    if ((destroyable && state == 0) || (state == 1 && formtimer < 30))
70
    {
71
        if (inhalesfx == 0)
72
        {
73
            inhalesfx = 1;
74
            snd_loop(snd_sneo_overpower);
75
            snd_pitch(snd_sneo_overpower, 0.1);
76
            snd_pitch_time(snd_sneo_overpower, 1, 90);
77
            snd_volume(snd_sneo_overpower, 0.75, 0);
78
            wreck = instance_create(x, y, obj_wreckpausespew);
79
            wreck.depth = depth - 1;
80
        }
81
        effecttimer++;
82
        if ((effecttimer % 6) == 0)
83
        {
84
            for (i = 0; i < 3; i++)
85
            {
86
                d = instance_create(x + mouthx, y + mouthy, obj_rouxls_power_up_orb);
87
                d.direction = irandom(40) + (i * 40) + 120;
88
                d.lifetime = 12;
89
                d.depth = depth + 1;
90
                d.image_blend = image_blend;
91
            }
92
        }
93
    }
94
    if ((state == 0 && x < (obj_growtangle.x - (obj_growtangle.sprite_width / 2.5))) || (state == 0 && obj_heart.x > (x + 70)))
95
    {
96
        state = 10;
97
        formtimer = 0;
98
        obj_sneo_bulletcontroller.special++;
99
        fakeheart = instance_create(obj_heart.x, obj_heart.y, obj_sneo_fakeheart);
100
    }
101
    else if (state == 0 && formtimer >= 320)
102
    {
103
        obj_sneo_bulletcontroller.special++;
104
        state++;
105
        formtimer = 45;
106
    }
107
    else if (state == 1 && formtimer >= 45)
108
    {
109
        with (obj_wreckpausespew)
110
            image_index = 1;
111
        with (obj_sneo_dollar)
112
            fade = 1;
113
        state++;
114
        formtimer = 45;
115
        if (x > (obj_growtangle.x + 70))
116
            obj_sneo_warped_box.state = 2;
117
        image_index = 4;
118
        image_angle = 1;
119
        snd_stop(snd_sneo_overpower);
120
        obj_sneo_warped_box.stopthesucc = 1;
121
    }
122
}
123
else if (state == 2 && formtimer >= 45)
124
{
125
    state++;
126
    image_index = 5;
127
    formtimer = 0;
128
    steptimer = pi - steptimer;
129
    obj_sneo_final_forme_hitbox.destroyable = false;
130
    global.turntimer = 360;
131
}
132
else if (state == 3)
133
{
134
    if (movecon == 0)
135
    {
136
        movetimer += (1 / moveframes);
137
        image_angle = lerp_ease_in(image_angle, 25, movetimer, 2);
138
        if (movetimer == 1)
139
        {
140
            movetimer = 0;
141
            movecon = 1;
142
        }
143
    }
144
    if (movecon == 2)
145
    {
146
        timer3++;
147
        if (timer3 > 20)
148
        {
149
            movetimer += (1 / moveframes);
150
            image_angle = lerp_ease_in(image_angle, -1, movetimer, 2);
151
            headoffset_x = lerp(0, -12, movetimer);
152
            headoffset_y = lerp(0, 2, movetimer);
153
        }
154
    }
155
    if (timer2 < 100)
156
        timer2++;
157
    x = lerp(x, camerax() + 439, timer2 / 100);
158
    if (x > (obj_growtangle.x + 70))
159
    {
160
        obj_sneo_warped_box.state = 2;
161
    }
162
    else
163
    {
164
        var _box = obj_sneo_warped_box;
165
        _box.suckx = min(obj_growtangle.x + 150, x + 106);
166
        _box.timer = clamp(scr_inverselerp
scr_inverselerp

function scr_inverselerp(arg0, arg1, arg2) { if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); }
(camerax() + 520, obj_growtangle.x + 100, x), 0, 1) * 60;
167
        _box.upper_sucky = y + 129;
168
        _box.lower_sucky = y + 159;
169
    }
170
    if (x > (camerax() + 438))
171
    {
172
        x = camerax() + 438;
173
        movecon = 2;
174
        if (movecon == 2 && movetimer == 1)
175
        {
176
            instance_destroy();
177
            aa = instance_create(x, ystart - abs(sin(steptimer + 0.15) * 40), obj_sneo_lastattack);
178
            with (aa)
179
            {
180
                yspot[0] = (obj_growtangle.y - (obj_growtangle.sprite_height / 2) - y_offset) + 40;
181
                yspot[1] = (obj_growtangle.y + (obj_growtangle.sprite_height / 2)) - y_offset - 40;
182
            }
183
            global.turntimer = 300;
184
        }
185
    }
186
}
187
else if (state == 4 && formtimer >= 25)
188
{
189
    formtimer = 0;
190
    state = 5;
191
    instance_create(x + mouthx, y + mouthy, obj_sneo_final_orb);
192
    image_index = 5;
193
}
194
else if (state == 10)
195
{
196
    fakeheart_speed = scr_movetowards
scr_movetowards

function scr_movetowards(arg0, arg1, arg2) { if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); }
(fakeheart_speed, 10, 1);
197
    with (fakeheart)
198
    {
199
        var _targetx = obj_sneo_final_forme.x + obj_sneo_final_forme.mouthx + 5;
200
        if (x > (_targetx - 10))
201
            _targetx += 20;
202
        move_towards_point(_targetx, obj_sneo_final_forme.y + obj_sneo_final_forme.mouthy, obj_sneo_final_forme.fakeheart_speed);
203
    }
204
    obj_sneo_warped_box.inhalespeed += 0.01;
205
    if (x > (x + mouthx + 10))
206
    {
207
        image_index = 4;
208
        snd_stop(snd_sneo_overpower);
209
    }
210
    if (formtimer > 45)
211
    {
212
        fakeheart.speed = 0;
213
        fakeheart.direction = 0;
214
        state = 11;
215
        formtimer = 0;
216
        image_index = 4;
217
        hidemouthback = 1;
218
        snd_stop(snd_sneo_overpower);
219
        obj_sneo_warped_box.image_alpha = 0;
220
        obj_sneo_warped_box.timer = 0;
221
        fakeheart.state = 1;
222
        with (obj_sneo_dollar)
223
            fade = 1;
224
    }
225
}
226
else if (state == 11)
227
{
228
    if (formtimer < 15)
229
        exit;
230
    if (x < (camerax() + 438))
231
        x += 4;
232
    if (x > (camerax() + 438) && formtimer < 65)
233
        formtimer = 65;
234
    if ((formtimer % 5) == 0 && formtimer >= 30 && formtimer <= 65)
235
    {
236
        var _hearthurt = snd_play(snd_hurt1);
237
        snd_pitch(_hearthurt, random_range(1.4, 2));
238
        d = instance_exists(obj_shake) ? 196 : instance_create(0, 0, obj_shake);
239
        d.shakex = ceil(1);
240
        d.shakey = ceil(1);
241
        if (dmgcon == 0)
242
        {
243
            dmgcon = 1;
244
            global.inv = -1;
245
            with (obj_spamton_neo_enemy)
246
                event_user(2);
247
        }
248
    }
249
    if (formtimer == 50)
250
    {
251
        obj_growtangle.timer = 0;
252
        obj_growtangle.growcon = 1;
253
        obj_growtangle.image_alpha = 1;
254
    }
255
    if (formtimer == 65)
256
    {
257
        obj_sneo_warped_box.inhale = 0;
258
        obj_sneo_warped_box.inhalespeed = 0;
259
        obj_sneo_warped_box.image_alpha = 1;
260
        obj_growtangle.image_alpha = 0;
261
    }
262
    if (x > (camerax() + 438))
263
    {
264
        if (formtimer < 50)
265
        {
266
            obj_growtangle.timer = 0;
267
            obj_growtangle.growcon = 1;
268
            obj_growtangle.image_alpha = 1;
269
        }
270
        formtimer = 0;
271
        state = 12;
272
        fakeheart.x = x + mouthx;
273
        fakeheart.y = y + mouthy;
274
        fakeheart.state = 2;
275
        image_index = 5;
276
    }
277
}
278
else if (state == 12)
279
{
280
    with (obj_wreckpausespew)
281
        image_index = 1;
282
    if (movetimer < 1)
283
    {
284
        movetimer += (1 / moveframes);
285
        headoffset_x = lerp(0, -12, movetimer);
286
        headoffset_y = lerp(0, 2, movetimer);
287
    }
288
    if (formtimer >= 30 && movetimer >= 1)
289
    {
290
        state = 2;
291
        formtimer = 0;
292
        image_index = 4;
293
        instance_destroy();
294
        instance_create(x, ystart - abs(sin(steptimer + 0.15) * 40), obj_sneo_lastattack);
295
    }
296
}
297
if (state >= 11)
298
{
299
    steptimer += 0.05;
300
    if (steptimer >= pi)
301
    {
302
        steptimer -= pi;
303
        d = instance_exists(obj_shake) ? 196 : instance_create(0, 0, obj_shake);
304
        d.shakex = ceil(2);
305
        d.shakey = ceil(2);
306
        snd_play(snd_screenshake);
307
    }
308
    y = ystart - (sin(steptimer) * 40);
309
}