Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_lancerbike_Step_0

(view raw script w/o annotations or w/e)
1
if (lcon == 1)
2
{
3
    orx = x;
4
    ory = y;
5
    ang = 0;
6
    ltimer = 0;
7
    shrinktimer = 0;
8
    lcon = 1.5;
9
}
10
if (lcon == 1.5)
11
{
12
    ltimer += 1;
13
    if (ltimer >= 10)
14
    {
15
        ltimer = 0;
16
        lcon = 2;
17
        snd_play(snd_cardrive);
18
    }
19
}
20
if (lcon >= 6 && lcon < 10)
21
{
22
    btimer += 1;
23
    if (btimer >= 10)
24
    {
25
        xoff = lengthdir_x(40, image_angle - 20);
26
        yoff = lengthdir_y(40, image_angle - 20);
27
        snd_play(snd_spearrise);
28
        bullet = instance_create(x - xoff, y - yoff, obj_regularbullet);
29
        with (bullet)
30
        {
31
            target = obj_lancerbike.target;
32
            damage = obj_lancerbike.damage;
33
            if (target == 0)
34
            {
35
                if (global.hp[1] <= (global.maxhp[1] / 2))
36
                    damage = ceil(global.hp[1] / 3);
37
            }
38
            timepoints = 0;
39
            sprite_index = spr_spadebullet;
40
            move_towards_point(obj_heart.x + 8, obj_heart.y + 8, 4);
41
            image_angle = direction;
42
            friction = -0.4;
43
        }
44
        bullet.depth = depth + 1;
45
        btimer = 0;
46
    }
47
}
48
if (lcon == 2)
49
{
50
    ltimer += 1;
51
    shrinktimer += 1;
52
    hspeed = sin(ltimer / 3) * 5;
53
    image_yscale = 2 - (sin(ltimer / 5) * 1);
54
    if (shrinktimer > 4)
55
        image_yscale = 2 - (sin(ltimer / 5) * 1 * (8 / shrinktimer));
56
    if (ltimer > 7)
57
    {
58
        image_angle -= (abs(sin(ltimer / 5)) * 4);
59
        ang = -image_angle;
60
    }
61
    if (ltimer > 4 && abs(sin(ltimer / 5)) <= 0.06)
62
    {
63
        lcon = 5;
64
        image_yscale = 2;
65
        direction = 180;
66
        speed = 4;
67
    }
68
}
69
if (lcon == 5)
70
{
71
    if (speed < 16)
72
        speed += 2;
73
    if (ang < 45)
74
        ang += 4;
75
    image_angle = -ang;
76
    if (x < (__view_get(e__VW.XView, 0) + 80))
77
        lcon = 6;
78
}
79
if (lcon == 6)
80
{
81
    if (ang < 135)
82
        ang += 10;
83
    image_angle = -ang;
84
    if (x <= (__view_get(e__VW.XView, 0) + 5))
85
    {
86
        lcon = 7;
87
        direction = 90;
88
    }
89
}
90
if (lcon == 7)
91
{
92
    if (y < (__view_get(e__VW.YView, 0) + 80))
93
    {
94
        if (ang < 225)
95
            ang += 10;
96
        if (y <= (__view_get(e__VW.YView, 0) + 5))
97
        {
98
            direction = 0;
99
            lcon = 8;
100
        }
101
    }
102
    else if (ang < 135)
103
    {
104
        ang += 10;
105
    }
106
    image_angle = -ang;
107
}
108
if (lcon == 8)
109
{
110
    if (x >= (__view_get(e__VW.XView, 0) + 540))
111
    {
112
        if (ang < 315)
113
            ang += 10;
114
        if (x >= (__view_get(e__VW.XView, 0) + 630))
115
        {
116
            direction = 270;
117
            lcon = 9;
118
        }
119
    }
120
    else if (ang < 225)
121
    {
122
        ang += 10;
123
    }
124
    image_angle = -ang;
125
}
126
if (lcon == 9)
127
{
128
    if (y > (ory - 70))
129
    {
130
        if (ang < 360)
131
            ang += 10;
132
        if (y >= (ory - 5))
133
        {
134
            y = ory;
135
            direction = 180;
136
            lcon = 10;
137
        }
138
    }
139
    else if (ang < 315)
140
    {
141
        ang += 10;
142
    }
143
    image_angle = -ang;
144
}
145
if (lcon == 10)
146
{
147
    ang = 0;
148
    image_angle = 0;
149
    if (x <= orx)
150
    {
151
        speed = 0;
152
        x = orx;
153
        lcon = 11;
154
        ltimer = 0;
155
    }
156
}
157
if (lcon == 11)
158
{
159
    sprite_index = spr_lancerbike_l;
160
    ltimer += 1;
161
    if (ltimer >= 25)
162
    {
163
        with (obj_regularbullet)
164
        {
165
            active = 0;
166
            image_alpha -= 0.2;
167
        }
168
        image_alpha = 1;
169
    }
170
    if (ltimer >= 30)
171
    {
172
        lcon = 0;
173
        endcon = 1;
174
    }
175
}
176
if (racecon == 1)
177
{
178
    sy = 0;
179
    s_moveup = 0;
180
    if (instance_exists(obj_susieandlancer_event))
181
    {
182
        s = obj_susieandlancer_event.s;
183
        sy = s.y;
184
        s_moveup = 1;
185
    }
186
    else if (instance_exists(obj_susieenemy))
187
    {
188
        s = 289;
189
        sy = s.y;
190
        s_moveup = 1;
191
    }
192
    orx = x;
193
    ory = y;
194
    ang = 0;
195
    racecon = 2;
196
    vspeed = -14 * choose(1, -1);
197
    rtimer = 0;
198
    maxr = 15 + random(25);
199
}
200
if (racecon == 2)
201
{
202
    if (s_moveup == 1)
203
    {
204
        if (s.y > -20)
205
            s.y -= 10;
206
    }
207
    if (y < (topy + 10))
208
        vspeed = 12;
209
    if (y > (bottomy - 10))
210
        vspeed = -12;
211
    rtimer += 1;
212
    if (rtimer > maxr)
213
    {
214
        vspeed = 0;
215
        racecon = 3;
216
        rtimer = 0;
217
    }
218
}
219
if (racecon == 3)
220
{
221
    rtimer += 1;
222
    if (rtimer == 5 || rtimer == 10)
223
    {
224
        snd_play(snd_lancerhonk);
225
        honkimg = instance_create(x - 60, y - 40, obj_afterimage_grow);
226
        with (honkimg)
227
            sprite_index = spr_lancernoise;
228
    }
229
    if (rtimer >= 25)
230
    {
231
        snd_play(snd_drive);
232
        racecon = 4;
233
        hspeed = -20;
234
        rtimer = 0;
235
        ang = 0;
236
    }
237
}
238
if (racecon == 4)
239
{
240
    if (s_moveup == 1)
241
    {
242
        s.y += 10;
243
        if (s.y >= sy)
244
        {
245
            s.y = sy;
246
            s_moveup = 0;
247
        }
248
    }
249
    rtimer += 1;
250
    ang += ((rtimer * 2) + 4);
251
    if (ang > 50)
252
        ang = 50;
253
    image_angle = -ang;
254
    if (x <= (__view_get(e__VW.XView, 0) - 40))
255
    {
256
        ang = 0;
257
        image_angle = 0;
258
        x = __view_get(e__VW.XView, 0) + 740;
259
        y = ory;
260
        hspeed = -12;
261
        racecon = 5;
262
    }
263
}
264
if (racecon == 5)
265
{
266
    if (x <= (orx + 5))
267
    {
268
        hspeed = 0;
269
        x = orx;
270
        racecon = 0;
271
        endcon = 1;
272
    }
273
}
274
if (endcon == 1)
275
{
276
    global.turntimer = 2;
277
    with (obj_lancerboss)
278
    {
279
        visible = 1;
280
        if (turns >= 4)
281
        {
282
            con = 1;
283
            with (obj_battlecontroller)
284
                noreturn = 1;
285
        }
286
    }
287
    with (obj_lancerboss3)
288
        visible = 1;
289
    instance_destroy();
290
}
291
with (obj_lancerboss)
292
{
293
    if (compliment >= 3)
294
    {
295
        with (obj_dmgwriter)
296
            spec = 1;
297
    }
298
}
299
300
enum e__VW
301
{
302
    XView,
303
    YView,
304
    WView,
305
    HView,
306
    Angle,
307
    HBorder,
308
    VBorder,
309
    HSpeed,
310
    VSpeed,
311
    Object,
312
    Visible,
313
    XPort,
314
    YPort,
315
    WPort,
316
    HPort,
317
    Camera,
318
    SurfaceID
319
}