Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_o_boxingcontroller_Draw_0

(view raw script w/o annotations or w/e)
1
if (instance_exists(obj_thrash_intro) || instance_exists(obj_thrash_transformation_transition))
2
    exit;
3
if (jumping == 1)
4
{
5
    draw_set_color(c_black);
6
    ht = (basey - y) / 8;
7
    draw_ellipse(basex - 62 - (ht * 2), basey - 40 - (ht / 2), basex + 38 + (ht * 2), basey + (ht / 2), false);
8
}
9
var sword_slash = 0;
10
if ((image_index == 12 && swordactive == 1) || (image_index == 13 && swordactive == 1) || (image_index == 14 && swordactive == 1))
11
    sword_slash = 1;
12
if (wireframe_boxing == 0 && dead > 0)
13
{
14
    drawflip = 0;
15
    image_index = 7;
16
}
17
if (drawflip == 0)
18
{
19
    draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, 0, image_blend, image_alpha);
20
    if (sword_slash == 0 && wireframe_boxing == 0)
21
    {
22
        draw_set_blend_mode(bm_normal);
23
        draw_sprite_ext_glow(headsprite, image_index, x, y, image_xscale, image_yscale, 0, c_white, image_alpha, c_white);
24
        draw_set_blend_mode(bm_add);
25
        draw_sprite_ext_glow(headsprite, image_index, x, y, image_xscale, image_yscale, 0, headcolor, image_alpha, c_white);
26
        draw_set_blend_mode(bm_normal);
27
    }
28
    if (laserpunchfadetimer > 0)
29
    {
30
        laserpunchfadetimer--;
31
        d3d_set_fog(1, c_white, 0, 0);
32
        if (sword_slash == 0 && wireframe_boxing == 0)
33
            draw_sprite_ext(headsprite, image_index, x, y, image_xscale, image_yscale, 0, image_blend, laserpunchfadetimer / 10);
34
        d3d_set_fog(0, c_white, 0, 0);
35
    }
36
    if (color_fade_alpha > 0)
37
    {
38
        c_extra = make_colour_rgb(255, 90, 195);
39
        color_fade_alpha -= 0.1;
40
        d3d_set_fog(1, c_extra, 0, 0);
41
        draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, 0, image_blend, color_fade_alpha);
42
        if (sword_slash == 0 && wireframe_boxing == 0)
43
            draw_sprite_ext(headsprite, image_index, x, y, image_xscale, image_yscale, 0, image_blend, color_fade_alpha);
44
        d3d_set_fog(0, c_extra, 0, 0);
45
    }
46
    if (turboactive > 0)
47
    {
48
        if (turbo_fade_state == 0)
49
            turbo_fade_alpha += 0.04;
50
        if (turbo_fade_state == 1)
51
            turbo_fade_alpha -= 0.04;
52
        if (turbo_fade_alpha > 0.3)
53
            turbo_fade_state = 1;
54
        if (turbo_fade_alpha < 0)
55
            turbo_fade_state = 0;
56
        d3d_set_fog(1, c_white, 0, 0);
57
        draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, 0, image_blend, turbo_fade_alpha);
58
        if (sword_slash == 0 && wireframe_boxing == 0)
59
        {
60
            if (draw_sprite_ext(headsprite, image_index, x, y, image_xscale, image_yscale, 0, image_blend, turbo_fade_alpha))
61
                d3d_set_fog(0, c_white, 0, 0);
62
        }
63
    }
64
    if (swordactive > 0)
65
    {
66
        if (sword_fade_state == 0)
67
            sword_fade_alpha += 0.08;
68
        if (sword_fade_state == 1)
69
            sword_fade_alpha -= 0.08;
70
        if (sword_fade_alpha > 0.6)
71
            sword_fade_state = 1;
72
        if (sword_fade_alpha < 0)
73
            sword_fade_state = 0;
74
        d3d_set_fog(1, c_white, 0, 0);
75
        if (sword_slash == 0 && wireframe_boxing == 0)
76
            draw_sprite_ext(headsprite, image_index, x, y, image_xscale, image_yscale, 0, image_blend, sword_fade_alpha);
77
        d3d_set_fog(0, c_white, 0, 0);
78
    }
79
}
80
else
81
{
82
    draw_sprite_ext(sprite_index, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, image_alpha);
83
    if (sword_slash == 0 && wireframe_boxing == 0)
84
    {
85
        draw_set_blend_mode(bm_normal);
86
        draw_sprite_ext_glow(headsprite, image_index, x, y, -image_xscale, image_yscale, 0, c_white, image_alpha, c_white);
87
        draw_set_blend_mode(bm_add);
88
        draw_sprite_ext_glow(headsprite, image_index, x, y, -image_xscale, image_yscale, 0, headcolor, image_alpha, c_white);
89
        draw_set_blend_mode(bm_normal);
90
    }
91
    if (color_fade_alpha > 0)
92
    {
93
        c_extra = make_colour_rgb(255, 90, 195);
94
        color_fade_alpha -= 0.1;
95
        d3d_set_fog(1, c_extra, 0, 0);
96
        draw_sprite_ext(sprite_index, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, color_fade_alpha);
97
        if (sword_slash == 0 && wireframe_boxing == 0)
98
            draw_sprite_ext(headsprite, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, color_fade_alpha);
99
        d3d_set_fog(0, c_extra, 0, 0);
100
    }
101
    if (turboactive > 0)
102
    {
103
        if (turbo_fade_state == 0)
104
            turbo_fade_alpha += 0.04;
105
        if (turbo_fade_state == 1)
106
            turbo_fade_alpha -= 0.04;
107
        if (turbo_fade_alpha > 0.3)
108
            turbo_fade_state = 1;
109
        if (turbo_fade_alpha < 0)
110
            turbo_fade_state = 0;
111
        d3d_set_fog(1, c_white, 0, 0);
112
        draw_sprite_ext(sprite_index, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, turbo_fade_alpha);
113
        if (sword_slash == 0 && wireframe_boxing == 0)
114
            draw_sprite_ext(headsprite, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, turbo_fade_alpha);
115
        d3d_set_fog(0, c_white, 0, 0);
116
    }
117
    if (swordactive > 0)
118
    {
119
        if (sword_fade_state == 0)
120
            sword_fade_alpha += 0.08;
121
        if (sword_fade_state == 1)
122
            sword_fade_alpha -= 0.08;
123
        if (sword_fade_alpha > 0.6)
124
            sword_fade_state = 1;
125
        if (sword_fade_alpha < 0)
126
            sword_fade_state = 0;
127
        d3d_set_fog(1, c_white, 0, 0);
128
        if (sword_slash == 0 && wireframe_boxing == 0)
129
            draw_sprite_ext(headsprite, image_index, x, y, -image_xscale, image_yscale, 0, image_blend, sword_fade_alpha);
130
        d3d_set_fog(0, c_white, 0, 0);
131
    }
132
}
133
if (specialcon == 1 && wireframe_boxing == 0)
134
{
135
    flameactive = 1;
136
    damage_multiplier = 1.5;
137
    if (specialcontimer == 0)
138
    {
139
        special_punch_count = 16;
140
        special_punch_turns = 3;
141
    }
142
    specialcontimer++;
143
    flameframe = (specialcontimer / 4) % 2;
144
    flamealpha = specialcontimer / 15;
145
    if (flamealpha >= 0.5)
146
        flamealpha = 0.5;
147
    if (specialcontimer >= 15)
148
    {
149
        flameactive = 1;
150
        flamealpha = 1 - (specialcontimer / 30);
151
    }
152
    if (specialcontimer >= 30)
153
    {
154
        specialcontimer = 0;
155
        specialcon = 0;
156
        image_index = 0;
157
    }
158
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_red, flamealpha);
159
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_yellow, flamealpha / 2);
160
}
161
if (specialcon == 2 && wireframe_boxing == 0)
162
{
163
    swordactive = 1;
164
    damage_multiplier = 1.2;
165
    if (specialcontimer == 0)
166
    {
167
        special_punch_count = 16;
168
        special_punch_turns = 3;
169
        if (!instance_exists(obj_rotating_sprites_controller))
170
        {
171
            instance_create(x, y, obj_rotating_sprites_controller);
172
            with (obj_rotating_sprite)
173
                sprite_index = spr_rotating_sprite1;
174
        }
175
    }
176
    specialcontimer++;
177
    flameframe = (specialcontimer / 4) % 2;
178
    flamealpha = specialcontimer / 15;
179
    if (flamealpha >= 0.5)
180
        flamealpha = 0.5;
181
    if (specialcontimer >= 15)
182
    {
183
        swordactive = 1;
184
        flamealpha = 1 - (specialcontimer / 30);
185
    }
186
    if (specialcontimer >= 30)
187
    {
188
        specialcontimer = 0;
189
        specialcon = 0;
190
        image_index = 0;
191
    }
192
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_blue, flamealpha);
193
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_teal, flamealpha / 2);
194
}
195
if (specialcon == 3 && wireframe_boxing == 0)
196
{
197
    laseractive = 1;
198
    damage_multiplier = 1.1;
199
    punch_speed_multiplier = 1.3;
200
    if (specialcontimer == 0)
201
    {
202
        special_punch_count = 32;
203
        special_punch_turns = 3;
204
        if (!instance_exists(obj_rotating_sprites_controller))
205
        {
206
            instance_create(x, y, obj_rotating_sprites_controller);
207
            with (obj_rotating_sprite)
208
                sprite_index = spr_rotating_sprite2;
209
        }
210
    }
211
    specialcontimer++;
212
    flameframe = (specialcontimer / 4) % 2;
213
    flamealpha = specialcontimer / 15;
214
    if (flamealpha >= 0.5)
215
        flamealpha = 0.5;
216
    if (specialcontimer >= 15)
217
    {
218
        laseractive = 1;
219
        flamealpha = 1 - (specialcontimer / 30);
220
    }
221
    if (specialcontimer >= 30)
222
    {
223
        specialcontimer = 0;
224
        specialcon = 0;
225
        image_index = 0;
226
    }
227
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_white, flamealpha);
228
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_yellow, flamealpha / 2);
229
}
230
if (specialcon == 4 && wireframe_boxing == 0)
231
{
232
    duckactive = 1;
233
    if (specialcontimer == 0)
234
    {
235
        special_punch_count = 16;
236
        special_punch_turns = 3;
237
        if (!instance_exists(obj_rotating_sprites_controller))
238
        {
239
            instance_create(x, y, obj_rotating_sprites_controller);
240
            with (obj_rotating_sprite)
241
                sprite_index = spr_rotating_sprite3;
242
        }
243
    }
244
    specialcontimer++;
245
    flameframe = (specialcontimer / 4) % 2;
246
    flamealpha = specialcontimer / 15;
247
    if (flamealpha >= 0.5)
248
        flamealpha = 0.5;
249
    if (specialcontimer >= 15)
250
    {
251
        duckactive = 1;
252
        flamealpha = 1 - (specialcontimer / 30);
253
    }
254
    if (specialcontimer >= 30)
255
    {
256
        specialcontimer = 0;
257
        specialcon = 0;
258
        image_index = 0;
259
    }
260
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_yellow, flamealpha);
261
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_yellow, flamealpha / 2);
262
}
263
if (specialcon == 5 && wireframe_boxing == 0)
264
{
265
    turboactive = 1;
266
    if (specialcontimer == 0)
267
    {
268
        special_punch_count = 999;
269
        special_punch_turns = 3;
270
    }
271
    specialcontimer++;
272
    flameframe = (specialcontimer / 4) % 2;
273
    flamealpha = specialcontimer / 15;
274
    if (flamealpha >= 0.5)
275
        flamealpha = 0.5;
276
    if (specialcontimer >= 15)
277
    {
278
        turboactive = 1;
279
        flamealpha = 1 - (specialcontimer / 30);
280
    }
281
    if (specialcontimer >= 30)
282
    {
283
        specialcontimer = 0;
284
        specialcon = 0;
285
        image_index = 0;
286
    }
287
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_white, flamealpha);
288
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_orange, flamealpha / 2);
289
}
290
if (specialcon == 6 && wireframe_boxing == 0)
291
{
292
    specialcontimer++;
293
    if (specialcontimer == 1)
294
    {
295
        dmgwr = instance_create(x - 30, y - 75, obj_dmgwriter);
296
        with (dmgwr)
297
        {
298
            delay = 8;
299
            type = 3;
300
            damage = 100;
301
            if ((global.hp[1] + 100) > global.maxhp[1])
302
                damage = global.maxhp[1] - global.hp[1];
303
        }
304
        health_count += 100;
305
        if (health_count > health_count_max)
306
            health_count = health_count_max;
307
        global.hp[1] += 100;
308
        if (global.hp[1] > global.maxhp[1])
309
            global.hp[1] = global.maxhp[1];
310
        snd_play(snd_power);
311
    }
312
    flameframe = (specialcontimer / 4) % 2;
313
    flamealpha = specialcontimer / 15;
314
    if (flamealpha >= 0.5)
315
        flamealpha = 0.5;
316
    if (specialcontimer >= 15)
317
        flamealpha = 1 - (specialcontimer / 30);
318
    if (specialcontimer >= 30)
319
    {
320
        specialcontimer = 0;
321
        specialcon = 0;
322
        image_index = 0;
323
    }
324
    draw_sprite_ext(sprite_index, 9 + flameframe, x, y, -image_xscale, image_yscale + abs(sin(specialcontimer / 4) / 2), 0, c_green, flamealpha);
325
    draw_sprite_ext(sprite_index, 10 - flameframe, x, y, -image_xscale, image_yscale, 0, c_lime, flamealpha / 2);
326
}
327
if (specialcon == 7 && wireframe_boxing == 0)
328
{
329
    specialcontimer++;
330
    if (specialcontimer > 0 && specialcontimer < 5)
331
        draw_sprite_ext(spr_bhero_item, specialcontimer * 2, x - 12, y - 161, 2, 2, 0, c_white, 1);
332
    else if (specialcontimer > 0)
333
        draw_sprite_ext(spr_bhero_item, 9, x - 12, y - 161, 2, 2, 0, c_white, 1 - ((specialcontimer - 10) / 20));
334
    flameframe = (specialcontimer / 4) % 2;
335
    flamealpha = specialcontimer / 15;
336
    if (flamealpha >= 0.5)
337
        flamealpha = 0.5;
338
    if (specialcontimer >= 15)
339
        flamealpha = 1 - (specialcontimer / 30);
340
    if (specialcontimer >= 30)
341
    {
342
        specialcontimer = 0;
343
        specialcon = 0;
344
        image_index = 0;
345
    }
346
}
347
if (specialcon == 8 && wireframe_boxing == 0)
348
{
349
    specialcontimer++;
350
    if (specialcontimer > 0 && specialcontimer < 5)
351
        draw_sprite_ext(spr_bhero_shield, specialcontimer * 2, x - 12, y - 161, 2, 2, 0, c_white, 1);
352
    else if (specialcontimer > 0)
353
        draw_sprite_ext(spr_bhero_shield, 9, x - 12, y - 161, 2, 2, 0, c_white, 1 - ((specialcontimer - 10) / 20));
354
    flameframe = (specialcontimer / 4) % 2;
355
    flamealpha = specialcontimer / 15;
356
    if (flamealpha >= 0.5)
357
        flamealpha = 0.5;
358
    if (specialcontimer >= 15)
359
        flamealpha = 1 - (specialcontimer / 30);
360
    if (specialcontimer >= 30 || global.boxingphase == 2)
361
    {
362
        specialcontimer = 0;
363
        specialcon = 0;
364
        image_index = 0;
365
    }
366
}
367
d3d_set_fog(0, c_white, 0, 0);