Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_singlescreen_shadowguy_blue_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
            if (desy > (obj_susiezilla_statue.y + 35))
63
                desy = obj_susiezilla_statue.y + 35;
64
            if (facing == 1)
65
                desx = (obj_susiezilla_statue.x - 100) + irandom_range(-24, 24);
66
            else
67
                desx = obj_susiezilla_statue.x + 100 + irandom_range(-24, 24);
68
        }
69
        if (state_timer > 1)
70
        {
71
            scr_obj_movetowards_point(desx, desy, clamp(point_distance(x, y, desx, desy) * 0.125, 0, 8));
72
            if (point_distance(x, y, desx, desy) <= 1)
73
            {
74
                remfacing = facing;
75
                speed = 0;
76
                fakevspeed = 0;
77
                state = states.attack;
78
                state_timer = 0;
79
            }
80
        }
81
    }
82
    if (state == states.attack)
83
    {
84
        facing = remfacing;
85
        flash--;
86
        state_timer++;
87
        if (state_timer == 1)
88
        {
89
            flash = 10;
90
            snd_stop(snd_swing);
91
            snd_play_pitch(snd_swing, 1.6);
92
        }
93
        if (state_timer == 11)
94
        {
95
            if (facing == 1)
96
                hspeed = -12;
97
            else
98
                hspeed = 12;
99
            fric_var = 1.55;
100
        }
101
        if (state_timer == 20)
102
        {
103
            flash = 0;
104
            kickactive = true;
105
            ds_list_clear(hit_list);
106
            sprite_index = s_spin;
107
            image_speed = 0.5;
108
            if (facing == 1)
109
                hspeed = 20;
110
            else
111
                hspeed = -20;
112
            fric_var = 0.35;
113
        }
114
        if (abs(x - obj_susiezilla_statue.x) <= 20 && kickactive)
115
        {
116
            kickactive = false;
117
            fric_var = 0.55;
118
            hspeed *= (-0.85 + random(0.2));
119
            vspeed = irandom_range(-2, 2);
120
            state = states.away;
121
            state_timer = 0;
122
        }
123
    }
124
    if (state == states.away)
125
    {
126
        state_timer++;
127
        if (state_timer > 0)
128
        {
129
            if (speed < 1)
130
            {
131
                fric_var = 0.85;
132
                desx = x;
133
                sprite_index = s_idle;
134
                image_speed = 0.25;
135
                state = states.advance;
136
                temp_counter = false;
137
                state_timer = irandom_range(-10, 0);
138
            }
139
        }
140
    }
141
    if (state == states.dead && state_timer == 0)
142
    {
143
        state_timer++;
144
        if (abs(hspeed) > 8)
145
        {
146
            snd_stop(snd_punchmed);
147
            snd_play_pitch(snd_punchmed, 0.65);
148
            for (var i = 0; i < 4; i++)
149
            {
150
                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);
151
                dust.depth = depth - 10;
152
                dust.vspeed = -4 - irandom(2) - (abs(hspeed) / 4);
153
                dust.gravity = 0.5;
154
                dust.image_speed = 0.5;
155
                dust.image_xscale = 2 + random_range(-0.2, 0);
156
                dust.image_xscale = dust.image_yscale;
157
                
scr_doom
scr_doom

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