Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_singlescreen_shadowguy_with_gun_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 && !i_ex(myhitbox))
25
{
26
    myhitbox = instance_create(x, y, obj_susiezilla_activehitbox);
27
    myhitbox.sprite_index = spr_whitepx;
28
    myhitbox_xoffset = 80;
29
    myhitbox_yoffset = 0;
30
    myhitbox.image_yscale = 30;
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
    if (fakeheight < maxheight || state == states.dead)
45
        friction = 0;
46
    else
47
        friction = fric_var;
48
    fakevspeed += fakegravity;
49
    fakeheight += fakevspeed;
50
    if (fakeheight >= maxheight)
51
    {
52
        fakeheight = maxheight;
53
        fakevspeed = 0;
54
        if (abs(hspeed) < 6)
55
            canhit = 0;
56
    }
57
    if (i_ex(obj_susiezilla_statue) && state != states.dead)
58
    {
59
        if (obj_susiezilla_statue.x < x)
60
            facing = -1;
61
        else
62
            facing = 1;
63
    }
64
    if (state == states.rope)
65
    {
66
        state_timer++;
67
        if (state_timer == 32)
68
        {
69
            state_timer = 0;
70
            state = states.intro;
71
        }
72
    }
73
    if (state == states.intro)
74
    {
75
        scr_obj_movetowards_point(desx, desy, clamp(point_distance(x, y, desx, desy) * 0.125, 0, 6));
76
        if (point_distance(x, y, desx, desy) < 2)
77
        {
78
            speed = 0;
79
            direction = 0;
80
            remfacing = facing;
81
            state_timer = 0;
82
            state = states.gun;
83
        }
84
    }
85
    if (state == states.reposition)
86
    {
87
        state_timer++;
88
        scr_obj_movetowards_point(desx, desy, clamp(point_distance(x, y, desx, desy) * 0.125, 0, 6));
89
        if (point_distance(x, y, desx, desy) < 2)
90
        {
91
            speed = 0;
92
            direction = 0;
93
            remfacing = facing;
94
            state_timer = 0;
95
            state = states.gun;
96
            if (i_ex(obj_susiezilla_player))
97
            {
98
                if (abs(x - obj_susiezilla_player.x) > 320)
99
                    state_timer = -20;
100
            }
101
        }
102
    }
103
    if (state == states.gun)
104
    {
105
        state_timer++;
106
        facing = remfacing;
107
        if (state_timer == 4)
108
        {
109
            flash = 10;
110
            sprite_index = s_fire;
111
            image_index = 0;
112
            image_speed = 0;
113
        }
114
        if (state_timer == 18)
115
        {
116
            image_speed = 0.25;
117
            shoot_angle = point_direction(x + (36 * facing), y - 64, obj_susiezilla_statue.x, obj_susiezilla_statue.y - 80);
118
        }
119
        if (state_timer == 18)
120
        {
121
            snd_stop(snd_gunshot_b);
122
            snd_play_pitch(snd_gunshot_b, 0.75);
123
            var tempx = x + (36 * facing);
124
            var tempy = y - 64;
125
            with (instance_create_depth(tempx, tempy, depth - 1, obj_susiezilla_singlescreen_hazard))
126
            {
127
                direction = other.shoot_angle;
128
                image_xscale = 2.5;
129
                image_yscale = 2.5;
130
                facing = other.facing;
131
                speed = 3;
132
                sprite_index = spr_tennis_ball_bullet;
133
                image_angle = 0;
134
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("draw_angle", 0, 4320, 480);
135
            }
136
        }
137
        if (state_timer == 24)
138
            image_speed = 0;
139
        if (state_timer == 40)
140
        {
141
            sprite_index = s_idle;
142
            image_index = 0;
143
            image_speed = 0.25;
144
            state = states.idle;
145
            state_timer = 0;
146
        }
147
    }
148
    if (state == states.idle)
149
    {
150
        state_timer++;
151
        facing = remfacing;
152
        if (state_timer == 32)
153
        {
154
            desx = xanchor + irandom_range(-48, 48);
155
            desy = clamp(yanchor + irandom_range(-48, 48), 200, 384);
156
            state = states.reposition;
157
            state_timer = 0;
158
        }
159
    }
160
    if (state == states.dead && state_timer == 0)
161
    {
162
        state_timer++;
163
        if (abs(hspeed) > 8)
164
        {
165
            snd_stop(snd_punchmed);
166
            snd_play_pitch(snd_punchmed, 0.65);
167
            for (var i = 0; i < 4; i++)
168
            {
169
                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);
170
                dust.depth = depth - 10;
171
                dust.vspeed = -4 - irandom(2) - (abs(hspeed) / 4);
172
                dust.gravity = 0.5;
173
                dust.image_speed = 0.5;
174
                dust.image_xscale = 2 + random_range(-0.2, 0);
175
                dust.image_xscale = dust.image_yscale;
176
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(dust, 10);
177
                dust.hspeed = -4 + (i * 2) + (hspeed / 8);
178
                dust.friction = 0.85;
179
            }
180
            fakevspeed = -abs(hspeed / 8);
181
        }
182
        else
183
        {
184
            snd_stop(snd_punchmed);
185
            snd_play_pitch(snd_punchmed, 0.8);
186
        }
187
    }
188
    var lx = 0;
189
    var rx = 1280;
190
    var ly = 0;
191
    with (obj_susiezilla_gamecontroller)
192
    {
193
        lx = xorig;
194
        rx = xorig + width;
195
        ly = yorig;
196
    }
197
    if (x <= (lx + 10))
198
    {
199
        x = lx + 10;
200
        hspeed = -hspeed / 2;
201
    }
202
    if (x >= (rx - 10))
203
    {
204
        x = rx - 10;
205
        hspeed = -hspeed / 2;
206
    }
207
    if (y <= (ly + 200))
208
    {
209
        y = ly + 200;
210
        vspeed = -vspeed / 2;
211
    }
212
    hitdir = direction;
213
    hitspeed = speed;
214
}
215
hitstop--;
216
if (hitstop == 0)
217
{
218
    canhit = 1;
219
    speed = memspeed;
220
    direction = memdir;
221
    fakegravity = 1;
222
    hitstop = -1;
223
}
224
if (hitstop > 0)
225
    flash = 0;
226
if (abs(hspeed) > fastestspeed)
227
    fastestspeed = abs(hspeed);
228
myxcenter = x - 6;
229
myycenter = (y - 34) + fakeheight;