Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_singlescreen_shadowguy_red_Step_0

(view raw script w/o annotations or w/e)
1
depth = 10000 - y;
2
with (obj_susiezilla_gamecontroller)
3
{
4
    var sourcedude = other.id;
5
    if (gameover)
6
    {
7
        other.speed = 0;
8
        other.image_speed = 0;
9
        with (obj_script_delayed)
10
        {
11
            if (target == sourcedude)
12
                instance_destroy();
13
        }
14
        with (obj_lerpvar)
15
        {
16
            if (target == sourcedude)
17
                instance_destroy();
18
        }
19
        other.gameover = true;
20
        exit;
21
    }
22
}
23
bobble++;
24
if (canhit == true && !i_ex(myhitbox))
25
{
26
    myhitbox = instance_create(x, y, obj_susiezilla_activehitbox);
27
    myhitbox.sprite_index = spr_whitepx;
28
    myhitbox_xoffset = -24;
29
    myhitbox_yoffset = -64;
30
    myhitbox.image_yscale = 48;
31
    myhitbox.image_xscale = 40;
32
    myhitbox.depth = depth - 20;
33
    myhitbox.image_blend = c_yellow;
34
    myhitbox.daddy = id;
35
    myhitbox.visible = false;
36
}
37
if (i_ex(myhitbox))
38
{
39
    if (!canhit || ropeheight != 0)
40
        safe_delete(myhitbox);
41
}
42
if (hitstop <= 0)
43
{
44
    fakevspeed += fakegravity;
45
    fakeheight += fakevspeed;
46
    if (fakeheight >= maxheight)
47
    {
48
        fakevspeed = 0;
49
        fakeheight = maxheight;
50
        if (abs(hspeed) < 6)
51
            canhit = 0;
52
    }
53
    if (fakeheight < maxheight || state == states.dead)
54
        friction = 0;
55
    else
56
        friction = fric_var;
57
    if (state == states.advance)
58
    {
59
        state_timer++;
60
        if (state_timer == 1)
61
        {
62
            lx = 0;
63
            rx = 1280;
64
            with (obj_susiezilla_gamecontroller)
65
            {
66
                lx = xorig;
67
                rx = xorig + width;
68
            }
69
            if (x < obj_susiezilla_player.myxcenter)
70
            {
71
                remfacing = 1;
72
                facing = 1;
73
                desx = max(lx + 12, obj_susiezilla_player.myxcenter - (96 + irandom(24)));
74
            }
75
            else
76
            {
77
                remfacing = 0;
78
                facing = 0;
79
                desx = min(rx - 12, obj_susiezilla_player.myxcenter + (96 + irandom(24)));
80
            }
81
            desy = clamp(obj_susiezilla_player.myycenter + 58 + irandom_range(-24, 24), 200, 384);
82
        }
83
        if (state_timer > 1)
84
        {
85
            scr_obj_movetowards_point(desx, desy, clamp(point_distance(x, y, desx, desy) * 0.25, 0, 8));
86
            if (point_distance(x, y, desx, desy) <= 15)
87
            {
88
                speed = 0;
89
                fakevspeed = 0;
90
                state = states.attack;
91
                state_timer = 0;
92
                if (nerf)
93
                    state_timer = -10;
94
            }
95
        }
96
    }
97
    if (state == states.attack)
98
    {
99
        facing = remfacing;
100
        flash--;
101
        state_timer++;
102
        if (state_timer == 1)
103
        {
104
            flash = 10;
105
            snd_stop(snd_swing);
106
            snd_play_pitch(snd_swing, 1.6);
107
            if (facing == 1)
108
                hspeed = -8;
109
            else
110
                hspeed = 8;
111
            fric_var = 1.55;
112
        }
113
        if (state_timer == 14)
114
        {
115
            flash = 0;
116
            kickactive = true;
117
            ds_list_clear(hit_list);
118
            sprite_index = s_spin;
119
            image_speed = 0.5;
120
            direction = point_direction(x, y, obj_susiezilla_player.x, obj_susiezilla_player.y + 90);
121
            speed = 20;
122
            if (nerf)
123
                speed = 16;
124
            fric_var = 0.7;
125
            state = states.away;
126
            state_timer = 0;
127
        }
128
    }
129
    if (state == states.away)
130
    {
131
        state_timer++;
132
        if (state_timer >= 10)
133
            kickactive = 0;
134
        if (state_timer > 0)
135
        {
136
            if (speed < 1)
137
            {
138
                kickactive = false;
139
                fric_var = 0.85;
140
                desx = x;
141
                sprite_index = s_idle;
142
                image_speed = 0.25;
143
                state = states.advance;
144
                temp_counter = false;
145
                state_timer = irandom_range(-10, 0);
146
            }
147
        }
148
    }
149
    if (state == states.dead && state_timer == 0)
150
    {
151
        state_timer++;
152
        if (abs(hspeed) > 8)
153
        {
154
            snd_stop(snd_punchmed);
155
            snd_play_pitch(snd_punchmed, 0.65);
156
            for (var i = 0; i < 4; i++)
157
            {
158
                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 - 20) + (i * 10), y, spr_dust1);
159
                dust.depth = depth - 10;
160
                dust.vspeed = -4 - irandom(2) - (abs(hspeed) / 4);
161
                dust.gravity = 0.5;
162
                dust.image_speed = 0.5;
163
                dust.image_xscale = 2 + random_range(-0.2, 0);
164
                dust.image_xscale = dust.image_yscale;
165
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(dust, 10);
166
                dust.hspeed = -4 + (i * 2) + (hspeed / 8);
167
                dust.friction = 0.85;
168
            }
169
        }
170
        else
171
        {
172
            snd_stop(snd_punchmed);
173
            snd_play_pitch(snd_punchmed, 0.8);
174
        }
175
    }
176
    if (kickactive)
177
    {
178
        var tempmask = obj_susiezilla_player.mask_index;
179
        obj_susiezilla_player.mask_index = spr_susiezilla_susie_hit_mask;
180
        var _hit = ds_list_create();
181
        collision_rectangle_list(x - 32, y + 14, x + 32, y - 22, obj_susiezilla_player, false, true, _hit, false);
182
        obj_susiezilla_player.mask_index = tempmask;
183
        for (a = 0; a < ds_list_size(_hit); a++)
184
        {
185
            if (ds_list_find_index(hit_list, ds_list_find_value(_hit, a).id) != -1)
186
                continue;
187
            ds_list_add(hit_list, ds_list_find_value(_hit, a).id);
188
            ds_list_find_value(_hit, a).take_hit(facing, damage, knockback);
189
            snd_stop(snd_punchmed);
190
            snd_play_pitch(snd_punchmed, 0.75);
191
        }
192
        ds_list_destroy(_hit);
193
    }
194
    var lx = 0;
195
    var rx = 1280;
196
    var ly = 0;
197
    with (obj_susiezilla_gamecontroller)
198
    {
199
        lx = xorig;
200
        rx = xorig + width;
201
        ly = yorig;
202
    }
203
    if (x <= (lx + 10))
204
    {
205
        x = lx + 10;
206
        hspeed = -hspeed / 2;
207
    }
208
    if (x >= (rx - 10))
209
    {
210
        x = rx - 10;
211
        hspeed = -hspeed / 2;
212
    }
213
    if (y <= (ly + 200))
214
    {
215
        y = ly + 200;
216
        vspeed = -vspeed / 2;
217
    }
218
    hitdir = direction;
219
    hitspeed = speed;
220
}
221
hitstop--;
222
if (hitstop == 0)
223
{
224
    canhit = 1;
225
    speed = memspeed;
226
    direction = memdir;
227
    fakegravity = 1;
228
    hitstop = -1;
229
}
230
if (hitstop > 0)
231
{
232
    kickactive = false;
233
    flash = 0;
234
}
235
if (abs(hspeed) > fastestspeed)
236
    fastestspeed = abs(hspeed);
237
myxcenter = x - 6;
238
myycenter = (y - 34) + fakeheight;