Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_balthizard_enemy_Draw_0

(view raw script w/o annotations or w/e)
1
scr_enemy_drawhurt_generic
scr_enemy_drawhurt_generic

function
scr_enemy_drawhurt_generic()
{ if (state == 3 && hurttimer >= 0) draw_sprite_ext(hurtsprite, 0, x + shakex + hurtspriteoffx, y + hurtspriteoffy, 2, 2, 0, image_blend, 1); }
();
2
shakehead.visible = false;
3
var _headindex = headindex;
4
if (eyesfollowgersonindex != -1)
5
    _headindex = eyesfollowgersonindex;
6
if (state == 0)
7
{
8
    if (flash == 1)
9
        fsiner++;
10
    siner += 0.16666666666666666;
11
    if (headflashtimer > 0)
12
    {
13
        headoffsetx += ((headflashtimer - (irandom(headflashtimer) * 2)) * 2);
14
        headoffsety += ((headflashtimer - (irandom(headflashtimer) * 2)) * 1);
15
    }
16
    if (headflashtimer > 0)
17
        headflashtimer--;
18
    if (headspeed > 2)
19
        headspeed -= headfriction;
20
    if (headspeed < -2)
21
        headspeed += headfriction;
22
    if (headoffsetx > 2)
23
    {
24
        headspeed -= headgravity;
25
    }
26
    else if (headoffsetx < -2)
27
    {
28
        headspeed += headgravity;
29
    }
30
    else
31
    {
32
        headoffsetx = 0;
33
        if (headspeed < 0.5 && headspeed > -0.5)
34
            headspeed = 0;
35
    }
36
    if (headoffsetx > 65)
37
    {
38
        headoffsetx = 65;
39
        headspeed = 0;
40
    }
41
    if (headoffsetx < -65)
42
    {
43
        headoffsetx = -65;
44
        headspeed = 0;
45
    }
46
    if (headspeed > 15)
47
        headspeed = 15;
48
    if (headspeed < -15)
49
        headspeed = -15;
50
    headoffsetx += headspeed;
51
    if (headoffsety > 0)
52
        headoffsety -= 0.5;
53
    if (headoffsety < 0)
54
        headoffsety += 0.5;
55
    if (eyedelay < 1)
56
        eyesiner++;
57
    animsiner++;
58
    if (acting == 20 && global.myfight == 3)
59
        headamplitude = lerp(headamplitude, 0, 0.25);
60
    else
61
        headamplitude = lerp(headamplitude, 5, 0.25);
62
    eyedelay--;
63
    if (eyesfollowgersonindex == -1 && eyedelay < 1)
64
        headindex = 7 + (sin(eyesiner / 12) * 5);
65
    draw_monster_body_part(spr_incense_turtle_tail, 1, x, y + (sin(animsiner / 8) * 4));
66
    draw_monster_body_part(spr_incense_turtle_leg1, 1, x, y);
67
    draw_monster_body_part(spr_incense_turtle_body, 1, x, y + (sin(animsiner / 8) * 2));
68
    draw_monster_body_part(spr_incense_turtle_leg2, 1, x, y);
69
    draw_monster_body_part(spr_incense_turtle_leg3, 1, x, y);
70
    if (lightup == true)
71
    {
72
        lightupfireframes += 0.25;
73
        draw_sprite_ext(spr_incense_turtle_head_fire, lightupfireframes, x + 26 + headoffsetx + (sin(animsiner / 8) * headamplitude), y + 46 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2), head_scale, head_scale, image_angle, image_blend, pieces_alpha2);
74
    }
75
    turthead = 5548;
76
    if (global.mercymod[myself] >= global.mercymax[myself])
77
        turthead = 3750;
78
    draw_monster_body_part(turthead, _headindex, x + 26 + headoffsetx + (sin(animsiner / 8) * headamplitude), y + 56 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2));
79
    if (global.myfight != 3 && acting != 20)
80
    {
81
        var spareable = 1;
82
        if (global.mercymod[myself] >= global.mercymax[myself])
83
            spareable = 2;
84
        if ((animsiner % 12) == 0 && lightup == false)
85
        {
86
            smoke = instance_create(((-6 + x + 26 + headoffsetx) - 14) + (sin(animsiner / 8) * headamplitude), (y + 56 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2)) - 20, obj_incense_turtle_shake_smoke);
87
            smoke.speed = choose(-1, -2, -3) + 1;
88
            smoke.mode = 1;
89
            smoke.image_xscale = 0.25;
90
            smoke.image_yscale = 0.25;
91
            smoke.image_alpha = 0.75;
92
            smoke.image_index = spareable;
93
        }
94
        if ((animsiner % 12) == 6 && lightup == false)
95
        {
96
            smoke = instance_create(6 + x + 26 + headoffsetx + 20 + (sin(animsiner / 8) * headamplitude), (y + 56 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2)) - 20, obj_incense_turtle_shake_smoke);
97
            smoke.speed = choose(1, 2, 3) - 1;
98
            smoke.mode = 1;
99
            smoke.image_xscale = 0.25;
100
            smoke.image_yscale = 0.25;
101
            smoke.image_alpha = 0.75;
102
            smoke.image_index = spareable;
103
        }
104
        if ((animsiner % 20) == 0)
105
        {
106
            smoke = instance_create(x + 126, y + 20 + (sin(animsiner / 8) * 4), obj_incense_turtle_shake_smoke);
107
            smoke.speed = choose(-1, 1);
108
            smoke.mode = 1;
109
            smoke.image_xscale = 0.35;
110
            smoke.image_yscale = 0.35;
111
            smoke.image_alpha = 0.75;
112
            smoke.image_index = spareable;
113
        }
114
    }
115
    if (acting == 20)
116
    {
117
        shakehead.x = x + 26 + headoffsetx;
118
        shakehead.y = y + 56 + headoffsety;
119
        shakehead.headflashtimer = headflashtimer;
120
        shakehead.visible = true;
121
        var xx1 = x + 26;
122
        var xx2 = x + 26 + headoffsetx;
123
        var flip = 1;
124
        if (headoffsetx < 0)
125
            flip = -1;
126
        draw_sprite_ext(spr_smallbullet, 0, xx1 + (point_distance(xx1, y, xx2, y) * 0.1 * flip), y + 56 + headoffsety, 1, 1, 0, neckcolor, 1);
127
        draw_sprite_ext(spr_smallbullet, 0, xx1 + (point_distance(xx1, y, xx2, y) * 0.33 * flip), y + 56 + headoffsety, 1, 1, 0, neckcolor, 1);
128
        draw_sprite_ext(spr_smallbullet, 0, xx1 + (point_distance(xx1, y, xx2, y) * 0.55 * flip), y + 56 + headoffsety, 1, 1, 0, neckcolor, 1);
129
    }
130
}
131
if (state == 10)
132
{
133
    if (transitioncon == 0)
134
    {
135
        transitiontimer++;
136
        if (transitiontimer == 1)
137
            snd_play(snd_equip);
138
        piece_xoffset[0] = lerp(0, -40, transitiontimer / 5);
139
        if (transitiontimer < 6)
140
            piece_index[1] += 1;
141
        piece_index[2] += 0.5;
142
        piece_index[3] += 0.5;
143
        piece_index[4] += 0.5;
144
        with (obj_incense_turtle_shake_smoke)
145
            image_alpha -= 0.2;
146
        headoffsety += 2;
147
        head_scale = lerp(2, 1.5, transitiontimer / 5);
148
        piece_xoffset[3] = lerp(0, 10, transitiontimer / 5);
149
        piece_xoffset[4] = lerp(0, 10, transitiontimer / 5);
150
        piece_yoffset[3] -= 1;
151
        piece_yoffset[4] -= 1;
152
        if (transitiontimer == 5)
153
        {
154
            transitiontimer = 0;
155
            transitioncon = 1;
156
        }
157
    }
158
    if (transitioncon == 1)
159
    {
160
        transitiontimer++;
161
        pieces_alpha = lerp(1, 0, transitiontimer / 5);
162
        darken_alpha = lerp(0, 1, transitiontimer / 5);
163
        piece_xoffset[1] = lerp(0, 20, transitiontimer / 5);
164
        piece_xoffset[3] = lerp(10, -10, transitiontimer / 5);
165
        piece_xoffset[4] = lerp(10, -15, transitiontimer / 5);
166
        headoffsetx = lerp(headoffsetx, 14, transitiontimer / 5);
167
        if (transitiontimer == 3)
168
            snd_play_x(snd_impact, 0.5, 2);
169
        if (transitiontimer == 4)
170
            piece_index[2] -= 1;
171
        if (transitiontimer == 5)
172
        {
173
            transitiontimer = 0;
174
            transitioncon = 2;
175
        }
176
    }
177
    if (transitioncon == 2)
178
    {
179
        transitiontimer++;
180
        if (piece_index[2] > 0)
181
            piece_index[2] -= 1;
182
        pieces_alpha2 = 0;
183
        darken_alpha = 0;
184
        if (transitiontimer == 1)
185
        {
186
            transitiontimer = 0;
187
            transitioncon = 3;
188
        }
189
    }
190
    if (transitioncon == 3)
191
    {
192
        transitiontimer++;
193
        if (transitiontimer == 1)
194
            piece_yoffset[2] += 3;
195
        if (transitiontimer == 2)
196
            piece_yoffset[2] -= 2;
197
        if (transitiontimer == 3)
198
            piece_yoffset[2] += 1;
199
        if (transitiontimer == 4)
200
            piece_yoffset[2] = 0;
201
    }
202
    if (transitioncon == 4)
203
    {
204
        transitiontimer++;
205
        if (piece_index[2] > 0)
206
            piece_index[2] += 1;
207
        if (transitiontimer == 2)
208
        {
209
            transitiontimer = 0;
210
            transitioncon = 5;
211
        }
212
    }
213
    if (transitioncon == 5)
214
    {
215
        transitiontimer++;
216
        if (transitiontimer == 1)
217
            snd_play(snd_equip);
218
        pieces_alpha = lerp(0, 1, transitiontimer / 5);
219
        darken_alpha = lerp(1, 0, transitiontimer / 5);
220
        piece_xoffset[1] = lerp(20, 0, transitiontimer / 5);
221
        piece_xoffset[3] = lerp(-10, 10, transitiontimer / 5);
222
        piece_xoffset[4] = lerp(-15, 10, transitiontimer / 5);
223
        headoffsetx = lerp(headoffsetx, 0, transitiontimer / 5);
224
        pieces_alpha2 = lerp(0, 1, transitiontimer / 5);
225
        if (transitiontimer == 1)
226
            piece_index[2] += 1;
227
        if (transitiontimer == 5)
228
        {
229
            transitiontimer = 0;
230
            transitioncon = 6;
231
        }
232
    }
233
    if (transitioncon == 6)
234
    {
235
        transitiontimer++;
236
        piece_xoffset[0] = lerp(-40, 0, transitiontimer / 5);
237
        if (transitiontimer < 6)
238
            piece_index[1] -= 1;
239
        if (piece_index[2] > 0)
240
            piece_index[2] -= 1;
241
        piece_index[3] -= 0.5;
242
        piece_index[4] -= 0.5;
243
        headoffsety += 2;
244
        head_scale = lerp(1.5, 2, transitiontimer / 5);
245
        piece_xoffset[3] = lerp(10, 0, transitiontimer / 5);
246
        piece_xoffset[4] = lerp(10, 0, transitiontimer / 5);
247
        piece_yoffset[3] += 1;
248
        piece_yoffset[4] += 1;
249
        if (transitiontimer == 5)
250
        {
251
            transitiontimer = 0;
252
            transitioncon = 0;
253
            state = 0;
254
            lineyoffset = -200;
255
        }
256
    }
257
    animsiner++;
258
    headamplitude = lerp(headamplitude, 5, 0.25);
259
    eyedelay--;
260
    if (eyesfollowgersonindex == -1 && eyedelay < 1)
261
        headindex = 7 + (sin(eyesiner / 12) * 5);
262
    if (stringcon == 0 && transitioncon < 4)
263
    {
264
        stringindex += 1;
265
        stringcount++;
266
        string_top_y -= 17;
267
        if (!i_ex(obj_incense_censer))
268
        {
269
            draw_sprite(spr_turtle_string_head, stringindex, string_top_x, string_top_y);
270
            var a = 0;
271
            repeat (stringcount)
272
            {
273
                draw_sprite(spr_turtle_string, stringindex, string_top_x, string_top_y + (a * 17));
274
                a++;
275
            }
276
        }
277
        if (string_top_y < (cameray() - 40))
278
            stringcon = 1;
279
    }
280
    if (lightup == true)
281
    {
282
        lightupfireframes += 0.25;
283
        draw_sprite_ext(spr_incense_turtle_head_fire, lightupfireframes, x + 26 + headoffsetx + (sin(animsiner / 8) * headamplitude), y + 46 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2), head_scale, head_scale, image_angle, image_blend, pieces_alpha2);
284
    }
285
    draw_sprite_ext(spr_incense_turtle_tail, piece_index[0], x + piece_xoffset[0], y + (sin(animsiner / 8) * 4) + piece_yoffset[0], image_xscale, image_yscale, image_angle, image_blend, pieces_alpha);
286
    draw_sprite_ext(spr_incense_turtle_leg1_transition, piece_index[1], x + piece_xoffset[1], y + piece_yoffset[1], image_xscale, image_yscale, image_angle, image_blend, pieces_alpha);
287
    if (!i_ex(obj_incense_censer))
288
        draw_sprite_ext(spr_incense_turtle_body_transition, piece_index[2], x + piece_xoffset[2], y + piece_yoffset[2], image_xscale, image_yscale, image_angle, image_blend, 1);
289
    else
290
        draw_sprite_ext(spr_incense_turtle_body_centered, piece_index[2], x + piece_xoffset[2] + 66, y + piece_yoffset[2] + 50, image_xscale, image_yscale, image_angle, image_blend, 1);
291
    draw_sprite_ext(spr_incense_turtle_leg3_transition, piece_index[4], x + piece_xoffset[4], y + piece_yoffset[4], image_xscale, image_yscale, image_angle, image_blend, pieces_alpha2);
292
    draw_sprite_ext(spr_incense_turtle_leg2_transition, piece_index[3], x + piece_xoffset[3], y + piece_yoffset[3], image_xscale, image_yscale, image_angle, image_blend, pieces_alpha2);
293
    turthead = 5548;
294
    if (global.mercymod[myself] >= global.mercymax[myself])
295
        turthead = 3750;
296
    draw_sprite_ext(turthead, _headindex, x + 26 + headoffsetx + (sin(animsiner / 8) * headamplitude), y + 56 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2), head_scale, head_scale, image_angle, image_blend, pieces_alpha2);
297
    if (darken_alpha > 0)
298
    {
299
        d3d_set_fog(true, c_black, 0, 1);
300
        draw_sprite_ext(spr_incense_turtle_leg3_transition, piece_index[4], x + piece_xoffset[4], y + piece_yoffset[4], image_xscale, image_yscale, image_angle, image_blend, darken_alpha);
301
        draw_sprite_ext(spr_incense_turtle_leg2_transition, piece_index[3], x + piece_xoffset[3], y + piece_yoffset[3], image_xscale, image_yscale, image_angle, image_blend, darken_alpha);
302
        draw_sprite_ext(turthead, _headindex, x + 26 + headoffsetx + (sin(animsiner / 8) * headamplitude), y + 56 + headoffsety + ((cos(animsiner / 6) * headamplitude) / 2), head_scale, head_scale, image_angle, image_blend, darken_alpha);
303
        d3d_set_fog(false, c_black, 0, 0);
304
    }
305
}
306
if (becomeflash == 0)
307
    flash = 0;
308
becomeflash = 0;
309
if (acting == 20)
310
{
311
    var b = 180 - shaketimer;
312
    ossafe_fill_rectangle_color(camerax() + 200, cameray() + 290, camerax() + 200 + b, cameray() + 300, c_aqua, c_aqua, c_aqua, c_aqua, 0);
313
    draw_sprite_ext(spr_poppup_hourglass, 1, camerax() + 200, cameray() + 295, 2, 2, 0, c_white, image_alpha);
314
}