Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_Step_0

(view raw script w/o annotations or w/e)
1
if (!slide)
2
{
3
    px = 0;
4
    py = 0;
5
}
6
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
() && keyboard_check_pressed(ord("P")) && height == 0)
7
    event_user(2);
8
if ((fall_speed != 0 || height > 0) && suplexCon == 0)
9
{
10
    height -= fall_speed;
11
    fall_speed += 1;
12
    if (height <= 0)
13
    {
14
        height = 0;
15
        if (bounce_count < 1)
16
        {
17
            fall_speed *= -0.5;
18
        }
19
        else
20
        {
21
            event_user(1);
22
            fall_speed = 0;
23
        }
24
        var _shake = instance_create(x, y, obj_shake);
25
        _shake.shakex = 0;
26
        if (bounce_count > 0)
27
            _shake.shakey = 2;
28
        bounce_count++;
29
        snd_play(snd_screenshake);
30
    }
31
}
32
if (hitstun > 0)
33
{
34
    hitstun--;
35
    exit;
36
}
37
var zombie_latched = false;
38
for (var i = 0; i < instance_number(obj_susiezilla_zombie); i++)
39
{
40
    zombie[i] = instance_find(obj_susiezilla_zombie, i);
41
    if (zombie[i].attackcon == 2 && zombie[i].hurtCon == 0)
42
        zombie_latched = true;
43
}
44
if (dashCon == 2)
45
{
46
    dashdusttimer++;
47
    if (dashdusttimer >= 5)
48
    {
49
        dashdusttimer = 0;
50
        repeat (2)
51
        {
52
            if (image_xscale > 0)
53
            {
54
                effect = instance_create(x - 5 - 14, y - 16, obj_house_placed_effect);
55
                effect.image_xscale = 1;
56
                effect.image_yscale = 1;
57
                effect.index_speed = 0.15;
58
            }
59
            else
60
            {
61
                effect = instance_create((x + 25) - 14, y - 16, obj_house_placed_effect);
62
                effect.image_xscale = 1;
63
                effect.image_yscale = 1;
64
                effect.index_speed = 0.15;
65
            }
66
        }
67
    }
68
}
69
allowinput = cancontrol == 1 && hurtcon == 0 && tailattackcon == 0 && hitstun == 0 && suplexCon != 1;
70
if (allowinput && init == 1)
71
{
72
    if (!slide)
73
    {
74
        if (down_h() && zombie_latched == false)
75
            py = wspeed / 2;
76
        if (right_h() && zombie_latched == false)
77
        {
78
            px = wspeed;
79
            if (suplexCon == 0)
80
                image_xscale = 2;
81
        }
82
        if (left_h() && zombie_latched == false)
83
        {
84
            px = -wspeed;
85
            if (suplexCon == 0)
86
                image_xscale = -2;
87
        }
88
        if (up_h() && zombie_latched == false)
89
            py = -wspeed / 2;
90
    }
91
    if (suplexCon > 0)
92
    {
93
        py *= (2/3);
94
        px *= (2/3);
95
    }
96
    else
97
    {
98
        if (button1_p())
99
            buffer_z = 2;
100
        if (!xcancel && button2_h())
101
            buffer_x = 2;
102
        else if (xcancel && !button2_h())
103
            xcancel = false;
104
        if (px != 0 && buffer_x > 0)
105
        {
106
            if (dashCon == 0 && dashTimer == 0)
107
            {
108
                dashCon = 1;
109
                dashDir = sign(px);
110
            }
111
            if (dashCon < 2)
112
            {
113
                dashTimer++;
114
                if (dashTimer == 4)
115
                {
116
                    dashTimer = 0;
117
                    dashCon = 2;
118
                    var _dash = instance_create(x, y, obj_animation);
119
                    _dash.sprite_index = spr_susiezilla_dashdust;
120
                    _dash.depth = depth - 1;
121
                    _dash.image_xscale = -image_xscale;
122
                    _dash.image_yscale = 2;
123
                    snd_play_pitch(snd_smallswing, 1.3);
124
                }
125
            }
126
            if (dashDir != 0 && sign(px) != dashDir)
127
            {
128
                dashCon = 1;
129
                dashTimer = 0;
130
            }
131
            dashDir = sign(px);
132
            if (dashCon == 2)
133
                px *= 1.5;
134
            else if (dashCon == 1)
135
                px *= 0.5;
136
        }
137
        if (px == 0 && (dashCon > 0 || dashTimer > 0))
138
        {
139
            dashDir = 0;
140
            dashTimer = 0;
141
            dashCon = 0;
142
        }
143
    }
144
}
145
if (px != 0 || py != 0)
146
{
147
    xmeet = 0;
148
    ymeet = 0;
149
    xymeet = 0;
150
    x += px;
151
    y += py;
152
    if (suplexCon == 0)
153
    {
154
        if (x < camerax())
155
            x = camerax();
156
        if (x > (camerax() + 640))
157
            x = camerax() + 640;
158
        if (y < 210)
159
            y = 210;
160
        if (y > 350)
161
            y = 350;
162
    }
163
}
164
if (allowinput && !slide && suplexCon == 0)
165
{
166
    if (abs(px) > 0 || abs(py) > 0)
167
    {
168
        if (sprite_index != spr_susiezilla_walk)
169
            image_index = 0;
170
        sprite_index = spr_susiezilla_walk;
171
        if (dashCon == 2)
172
            image_index += 0.495;
173
        else if (dashCon == 1)
174
            image_index += 0.11;
175
        else
176
            image_index += 0.33;
177
    }
178
    else if (sprite_index == spr_susiezilla_walk)
179
    {
180
        sprite_index = spr_susiezilla_idle;
181
    }
182
}
183
if (buffer_z > 0 && hurtcon == 0 && tailattackcon == 0 && suplexCon == 0)
184
{
185
    var _inst = -4;
186
    var _faceDirection = sign(image_xscale);
187
    if (py < 0)
188
        _inst = collision_rectangle(x, y - 20, x + (_faceDirection * 40), y + 2, obj_susiezilla_shadowguy, false, true);
189
    if (dashCon == 2)
190
    {
191
        tailattackcon = 11;
192
        slide = true;
193
        dashCon = 0;
194
        xcancel = true;
195
    }
196
    else if (_inst != -4 && _inst.hp > 0)
197
    {
198
        with (_inst)
199
            event_user(2);
200
        suplexCon = 1;
201
        snd_play(snd_grab);
202
    }
203
    else
204
    {
205
        tailattackcon = 1;
206
    }
207
}
208
if (suplexCon > 0)
209
{
210
    invinciblecon = 1;
211
    timer++;
212
    if (suplexCon == 1)
213
    {
214
        sprite_index = spr_susiezilla_suplex;
215
        image_speed = 0;
216
        image_index = 0;
217
        if (timer >= 10)
218
        {
219
            timer = 0;
220
            suplexCon++;
221
            snd_play(snd_jump);
222
        }
223
    }
224
    else if (suplexCon == 2)
225
    {
226
        image_index = 1;
227
        height = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(timer / 15, 3) * 140;
228
        if (timer >= 15)
229
        {
230
            timer = 0;
231
            suplexCon++;
232
        }
233
    }
234
    else if (suplexCon == 3)
235
    {
236
        image_index = 2;
237
        height = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(1 - (timer / 15), 3) * 140;
238
        if (timer >= 15)
239
        {
240
            invincibilitytimer = -20;
241
            event_user(1);
242
            px = sign(image_xscale) * -2;
243
            slide = true;
244
            fall_speed = -6;
245
            bounce_count = 1;
246
            
scr_bounce_land
scr_bounce_land

function
scr_bounce_land(arg0)
{ bounce_land = instance_create(x, y, obj_bounce_land); bounce_land.target = id; bounce_land.strength = arg0; }
(2);
247
            var _shake = instance_create(x, y, obj_shake);
248
            _shake.shakex = 0;
249
            _shake.shakey = 6;
250
            snd_play(snd_screenshake);
251
        }
252
    }
253
}
254
if (tailattackcon > 0)
255
{
256
    if (tailattackcon == 1)
257
    {
258
        snd_play_pitch(snd_motor_upper_quick, 1 + random(0.3));
259
        sprite_index = spr_susiezilla_tail;
260
        image_index = 0;
261
        slide = false;
262
        tail_hitbox = instance_create(x, y, obj_susiezilla_player_hitbox);
263
        tail_hitbox.image_xscale = image_xscale;
264
        tail_hitbox.image_yscale = image_yscale;
265
        tail_hitbox.sprite_index = spr_susiezilla_tail_hitbox;
266
        tail_hitbox.image_index = 0;
267
        tail_hitbox.image_speed = 0.5;
268
        tail_hitbox.image_blend = c_red;
269
        tail_hitbox.depth = depth - 1;
270
        tail_hitbox.visible = false;
271
        tail_hitbox.timer = 4;
272
        tailattackcon = 2;
273
    }
274
    if (tailattackcon == 2)
275
    {
276
        tailattacktimer++;
277
        if (tailattacktimer == 3)
278
            image_index = 1;
279
        if (tailattacktimer >= 8)
280
            event_user(1);
281
    }
282
    if (tailattackcon == 11)
283
    {
284
        snd_play_pitch(snd_motor_upper_quick, 0.8 - random(0.3));
285
        sprite_index = spr_susiezilla_tail;
286
        image_index = 0;
287
        tail_hitbox = instance_create(x, y, obj_susiezilla_player_hitbox);
288
        tail_hitbox.image_xscale = image_xscale;
289
        tail_hitbox.image_yscale = image_yscale + 1;
290
        tail_hitbox.sprite_index = spr_susiezilla_tail_hitbox;
291
        tail_hitbox.image_index = 0;
292
        tail_hitbox.image_speed = 0.5;
293
        tail_hitbox.image_blend = c_red;
294
        tail_hitbox.depth = depth - 1;
295
        tail_hitbox.visible = false;
296
        tail_hitbox.timer = 14;
297
        tail_hitbox.slideAttack = true;
298
        tailattackcon = 12;
299
    }
300
}
301
if (tailattackcon == 12 && hitstun == 0)
302
{
303
    tailattacktimer++;
304
    if (tailattacktimer == 3)
305
        image_index = 1;
306
    if (tailattacktimer == 6)
307
    {
308
        px = 
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); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(px, 0, 3);
309
        py = 
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); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(py, 0, 1.5);
310
    }
311
    if (tailattacktimer == 12)
312
    {
313
        px = 
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); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(px, 0, 3);
314
        py = 
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); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(py, 0, 1.5);
315
        xcancel = true;
316
    }
317
    if (tailattacktimer >= 18)
318
        event_user(1);
319
}
320
if (hurtcon > 0)
321
{
322
    hurttimer += 1;
323
    if (hurttimer >= hurt_length && fall_speed == 0 && height <= 0)
324
    {
325
        px = 0;
326
        event_user(1);
327
    }
328
}
329
if (turncon > 0 && hurtcon == 0 && tailattackcon == 0)
330
{
331
    turntimer += 1;
332
    if (turntimer >= 4)
333
    {
334
        sprite_index = spr_susiezilla_idle;
335
        if (image_xscale > 0)
336
            image_xscale = -2;
337
        else
338
            image_xscale = 2;
339
        event_user(1);
340
    }
341
}
342
invincibilitytimer += 1;
343
if (invincibilitytimer >= 0 && invinciblecon == 1)
344
    invinciblecon = 0;
345
if (invinciblecon == 1 && visible == true)
346
    visible = false;
347
else
348
    visible = true;
349
buffer_z -= 1;
350
buffer_x -= 1;
351
buffer_u -= 1;
352
buffer_d -= 1;
353
buffer_r -= 1;
354
buffer_l -= 1;
355
if (stumbler > 0)
356
    stumbler--;
357
init = 1;