Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_player_Step_0

(view raw script w/o annotations or w/e)
1
controlmode = 0;
2
if (i_ex(obj_tenna_enemy) && tennainit == false)
3
{
4
    visible = true;
5
    tennainit = true;
6
}
7
depth = 10000 - (y + 84);
8
if (i_ex(obj_tenna_enemy))
9
    depth = 1000 - (y + 84);
10
with (obj_susiezilla_gamecontroller)
11
{
12
    var sourcedude = other.id;
13
    if (gameover)
14
    {
15
        other.speed = 0;
16
        other.image_speed = 0;
17
        other.accel = 0;
18
        lx = 0;
19
        rx = 1280;
20
        shakeval = 0;
21
        with (obj_susiezilla_gamecontroller)
22
        {
23
            lx = xorig;
24
            rx = xorig + width;
25
            shakeval = shake;
26
        }
27
        camerax_set(clamp(
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; }
(camerax(), obj_susiezilla_statue.x - 320, abs(camerax() - (obj_susiezilla_statue.x - 320)) * 0.1), lx, rx - 640) + random_range(-shakeval, shakeval));
28
        cameray_set(random_range(-shakeval, shakeval));
29
        exit;
30
    }
31
}
32
accel = 0.8;
33
maxspeed = lerp(maxspeed, 16, 0.25);
34
attack1thresh = 4;
35
attack2thresh = 10;
36
if (hitstop <= 0)
37
{
38
    friction = 0.2;
39
    if (dashcon <= 0 && canmove >= 0)
40
    {
41
        if (facing == 0)
42
        {
43
            if (hspeed > 2)
44
                sprite_index = s_forward;
45
            else if (hspeed < -2)
46
                sprite_index = s_backward;
47
            else
48
                sprite_index = s_idle;
49
        }
50
        else if (hspeed > 2)
51
        {
52
            sprite_index = s_backward;
53
        }
54
        else if (hspeed < -2)
55
        {
56
            sprite_index = s_forward;
57
        }
58
        else
59
        {
60
            sprite_index = s_idle;
61
        }
62
    }
63
    if (dashcon == 1)
64
    {
65
        if (controlmode == 0)
66
        {
67
            var slowdownVersion = false;
68
            if (slowdownVersion == true)
69
            {
70
                accel *= 0.7;
71
                maxspeed *= 0.7;
72
            }
73
            dashtimer++;
74
            sprite_index = s_prepare;
75
            image_index = 0;
76
            if (dashtimer == 1)
77
                snd_play_x(snd_motor_swing_down, 0.8, 1.2);
78
            if (dashtimer == 9)
79
                snd_stop(snd_motor_swing_down);
80
            if (dashtimer >= 10)
81
            {
82
                hitactive = true;
83
                dashcon = 2;
84
                dashtimer = 0;
85
            }
86
        }
87
    }
88
    if (dashcon == 2)
89
    {
90
        if (controlmode == 0)
91
        {
92
            dashtimer++;
93
            accel = 4 - (dashtimer / 5);
94
            maxspeed = 32 - dashtimer;
95
            image_speed = 0.5;
96
            sprite_index = s_attack;
97
            if (i_ex(obj_tenna_enemy) && obj_tenna_enemy.con > 1)
98
            {
99
            }
100
            if ((dashtimer % 3) == 1)
101
            {
102
                i = 0;
103
                dust = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(x + (sprite_width / 2), y + sprite_height, spr_dust1);
104
                dust.depth = depth + 10;
105
                dust.vspeed = -4 - irandom(2) - (abs(hspeed) / 4);
106
                dust.gravity = 0.5;
107
                dust.image_speed = 0.5;
108
                dust.image_xscale = 2 + random_range(-0.2, 0);
109
                dust.image_xscale = dust.image_yscale;
110
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(dust, 10);
111
                dust.hspeed = -4 + (i * 2) + (hspeed / 8);
112
                dust.friction = 0.85;
113
                snd_stop(snd_motor_upper_2);
114
                snd_play_x(snd_motor_upper_2, 1, 1 + (dashtimer / 45) + random(0.1));
115
            }
116
            if (dashtimer >= 14)
117
                sprite_index = s_postattack;
118
            if (dashtimer >= 15)
119
            {
120
                hitactive = false;
121
                dashtimer = 0;
122
                dashcon = 3;
123
            }
124
        }
125
    }
126
    if (dashcon == 3)
127
    {
128
        dashtimer++;
129
        sprite_index = s_postattack;
130
        image_speed = 0;
131
        if (dashtimer >= recoverytime)
132
        {
133
            dashtimer = 0;
134
            dashcon = 0;
135
        }
136
    }
137
    canmove++;
138
    invuln = 
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; }
(invuln, 0, 1);
139
    if (canmove == 0)
140
    {
141
        image_speed = 0;
142
        invuln = 40;
143
    }
144
    if (visible && !alarm[1])
145
    {
146
        if (canmove)
147
        {
148
            if (left_h())
149
            {
150
                hspeed -= accel;
151
                facing = 1;
152
                if (hspeed > 0)
153
                    hspeed -= 0.2;
154
            }
155
            if (right_h())
156
            {
157
                hspeed += accel;
158
                facing = 0;
159
                if (hspeed < 0)
160
                    hspeed += 0.2;
161
            }
162
            if (up_h())
163
            {
164
                vspeed -= (accel / 1.5);
165
                if (vspeed > 0)
166
                    vspeed -= 0.1;
167
            }
168
            if (down_h())
169
            {
170
                vspeed += (accel / 1.5);
171
                if (vspeed < 0)
172
                    vspeed += 0.1;
173
            }
174
            button1buffer--;
175
            if (button1_p())
176
                button1buffer = 10;
177
            if (controlmode == 0)
178
            {
179
                if (button1buffer && dashcon == 0)
180
                {
181
                    dashcon = 1;
182
                    dashtimer = 0;
183
                }
184
            }
185
        }
186
    }
187
    var clampmode = 1;
188
    if (clampmode == 0)
189
    {
190
        vspeed = clamp(vspeed, -maxspeed / 2, maxspeed / 2);
191
        hspeed = clamp(hspeed, -maxspeed, maxspeed);
192
    }
193
    if (clampmode == 1)
194
    {
195
        vspeed = clamp(vspeed, -maxspeed / 2, maxspeed / 2);
196
        hspeed = clamp(hspeed, -maxspeed, maxspeed);
197
        speed = clamp(speed, -maxspeed, maxspeed);
198
    }
199
    lx = 0;
200
    rx = 1280;
201
    with (obj_susiezilla_gamecontroller)
202
    {
203
        lx = xorig;
204
        rx = xorig + width;
205
    }
206
    if ((hspeed > 0 && x > (rx - 80)) || (hspeed < 0 && x < (lx + 20)))
207
        hspeed = -(hspeed * 0.75);
208
    if ((vspeed > 0 && y > 270) || (vspeed < 0 && y < 108))
209
        vspeed = -(vspeed * 0.65);
210
}
211
if (canmove < 0)
212
{
213
    dashcon = 0;
214
    if (alarm[0])
215
    {
216
        image_speed = 0.5;
217
        sprite_index = s_attack;
218
    }
219
    else
220
    {
221
        image_speed = 0.25;
222
        sprite_index = s_hurt;
223
    }
224
}
225
hitstop--;
226
if (hitstop == 0)
227
{
228
    hitstop = -1;
229
    direction = memdir;
230
    image_blend = c_white;
231
    hspeed = memhspeed;
232
    vspeed = memvspeed;
233
    speed = memspeed;
234
    maxspeed = memmaxspeed;
235
    accel = memaccel;
236
    image_speed = memimagespeed;
237
}
238
myxcenter = x + 32;
239
myycenter = y + 40;
240
oldxcenter = xprevious + 32;
241
oldycenter = yprevious + 40;
242
var lx = 0;
243
var rx = 1280;
244
var shakeval = 0;
245
with (obj_susiezilla_gamecontroller)
246
{
247
    lx = xorig;
248
    rx = xorig + width;
249
    shakeval = shake;
250
}
251
if (!instance_exists(obj_susiezilla_pan_object))
252
{
253
    camerax_set(clamp(myxcenter - 320, lx, rx - 640) + random_range(-shakeval, shakeval));
254
    cameray_set(random_range(-shakeval, shakeval));
255
}
256
with (obj_susiezilla_singlescreen_hud_element)
257
{
258
    var myx = camerax() + xoff;
259
    timer++;
260
    cur_movespeed = 
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; }
(cur_movespeed, movespeed, 0.0075);
261
    if (abs(x - myx) > 0.1)
262
        x = 
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; }
(x, myx, clamp(abs(x - myx) * cur_movespeed, 0, 64));
263
}
264
with (obj_susiezilla_singlescreen_hud_tenna)
265
{
266
    with (obj_writer)
267
        depth = -99;
268
    var jump = abs(x - xprevious) * 0.125;
269
    var oof = x - (camerax() + xoff);
270
    var ooof = -abs(sin(timer * 0.5) * jump * 2);
271
    with (obj_ch3_tennashouter_alt)
272
    {
273
        txoff = 33 + oof;
274
        tyoff = -5 + ooof;
275
        textxoff = 18 + oof;
276
        textyoff = -10 + ooof;
277
    }
278
}