Undertale script viewer

← back to main script listing

gml_Object_obj_mettb_body_Draw_0

(view raw script w/o annotations or w/e)
1
if (noleg == 0)
2
{
3
    if (legr == 0)
4
    {
5
        legrsprite = 520;
6
        xoffr = -14;
7
        yoffr = 10;
8
        legrh = 36;
9
    }
10
    if (legr == 1)
11
    {
12
        legrsprite = 521;
13
        xoffr = -16;
14
        yoffr = 6;
15
        legrh = 8;
16
    }
17
    if (legr == 2)
18
    {
19
        legrsprite = 528;
20
        xoffr = -10;
21
        yoffr = 14;
22
        legrh = 60;
23
    }
24
    if (legr == 3)
25
    {
26
        legrsprite = 526;
27
        xoffr = -10;
28
        yoffr = 14;
29
        legrh = 30;
30
    }
31
    if (legr == 4)
32
    {
33
        legrsprite = 527;
34
        xoffr = -18;
35
        yoffr = 2;
36
        legrh = 42;
37
    }
38
    if (legr == 9)
39
    {
40
        legrsprite = 524;
41
        xoffr = 20;
42
        yoffr = 6;
43
        legrh = 8;
44
    }
45
    if (legr == 10)
46
    {
47
        legrsprite = 525;
48
        xoffr = 15;
49
        yoffr = 2;
50
        legrh = 0;
51
    }
52
    if (legl == 0)
53
    {
54
        leglsprite = 520;
55
        xoffl = -14;
56
        yoffl = 10;
57
        leglh = 36;
58
    }
59
    if (legl == 1)
60
    {
61
        leglsprite = 521;
62
        xoffl = -16;
63
        yoffl = 6;
64
        leglh = 8;
65
    }
66
    if (legl == 2)
67
    {
68
        leglsprite = 528;
69
        xoffl = -10;
70
        yoffl = 14;
71
        leglh = 60;
72
    }
73
    if (legl == 3)
74
    {
75
        leglsprite = 526;
76
        xoffl = -10;
77
        yoffl = 14;
78
        leglh = 30;
79
    }
80
    if (legl == 4)
81
    {
82
        leglsprite = 527;
83
        xoffl = -18;
84
        yoffl = 2;
85
        leglh = 42;
86
    }
87
    if (legl == 9)
88
    {
89
        leglsprite = 522;
90
        xoffl = -5;
91
        yoffl = 2;
92
        leglh = 6;
93
    }
94
    if (legl == 10)
95
    {
96
        leglsprite = 523;
97
        xoffl = 0;
98
        yoffl = 5;
99
        leglh = 2;
100
    }
101
}
102
if (arml == 0)
103
    armlsprite = 529;
104
if (arml == 1)
105
    armlsprite = 530;
106
if (arml == 2)
107
    armlsprite = 531;
108
if (arml == 3)
109
    armlsprite = 532;
110
if (arml == 4)
111
    armlsprite = 533;
112
if (arml == 5)
113
    armlsprite = 534;
114
if (arml == 6)
115
    armlsprite = 535;
116
if (arml == 7)
117
    armlsprite = 536;
118
if (armr == 0)
119
    armrsprite = 529;
120
if (armr == 1)
121
    armrsprite = 530;
122
if (armr == 2)
123
    armrsprite = 531;
124
if (armr == 3)
125
    armrsprite = 532;
126
if (armr == 4)
127
    armrsprite = 533;
128
if (armr == 5)
129
    armrsprite = 534;
130
if (armr == 6)
131
    armrsprite = 535;
132
if (armr == 7)
133
    armrsprite = 536;
134
if (legl != 9 && legr != 9 && legl != 10 && legr != 10)
135
{
136
    offangle = 0;
137
    if (leglh > 10 || (legrh > 10 && sineron == 1))
138
        siner += 1;
139
    if (sineron == 1)
140
    {
141
        rsin += 1;
142
        lsin += 1;
143
    }
144
    if (leglh > legrh)
145
    {
146
        legh = leglh * 2;
147
        lsin = 0;
148
    }
149
    else
150
    {
151
        legh = legrh * 2;
152
        rsin = 0;
153
    }
154
    if (abs(leglh - legrh) < 5)
155
    {
156
        lsin = 0;
157
        rsin = 0;
158
    }
159
}
160
else
161
{
162
    if (leglh > legrh)
163
        legh = leglh * 2;
164
    else
165
        legh = legrh * 2;
166
    if (legl == 10)
167
        lsin = 0;
168
    if (sineron == 1)
169
    {
170
        siner += 1;
171
        rsin += 1;
172
        lsin += 1;
173
    }
174
    offangle = 10;
175
}
176
ds1 = random(dsf * 2) - dsf;
177
ds2 = random(dsf * 2) - dsf;
178
if (noleg == 0)
179
{
180
    draw_sprite_ext(legrsprite, 0, x + 90 + xoffr, (y + 120 + yoffr) - legh - (sin(siner / 2) * 0.05), 2, 2 - (sin(siner / 3.5) * 0.05), (sin(rsin / 7) * 10) - offangle, myblend, myalpha);
181
    draw_sprite_ext(leglsprite, 0, (x + 90) - xoffl - 32, (y + 120 + yoffl) - legh - (sin(siner / 2) * 0.05), -2, 2 - (sin(siner / 3.5) * 0.05), sin(lsin / 7) * 10, myblend, myalpha);
182
}
183
if (noarm == 0)
184
{
185
    if (arml != 5)
186
        draw_sprite_ext(armlsprite, 0, x + 36 + sin(siner / 3.5), (y - legh) + 80 + (cos(siner / 3.5) * 2), 2, 2, 0, myblend, myalpha);
187
    if (armr != 5)
188
        draw_sprite_ext(armrsprite, 0, x + 110 + sin(siner / 3.5), (y - legh) + 80 + (cos(siner / 3.5) * 2), -2, 2, 0, myblend, myalpha);
189
}
190
if (bodyopen == 1)
191
{
192
    if (bodyimg < 5)
193
        bodyimg += 0.25;
194
}
195
else if (bodyimg > 0)
196
{
197
    bodyimg -= 0.25;
198
}
199
draw_sprite_ext(spr_mettb_upperbody, bodyimg, x + 72 + sin(siner / 3.5) + ds1, (y - legh) + 134 + (cos(siner / 3.5) * 2) + ds2, 2, 2, 0, myblend, myalpha);
200
if (instance_exists(obj_mettheart_parent) == 0 && instance_exists(obj_mettheart_burst) == 0 && heartdead == 0)
201
    draw_sprite_ext(spr_mettb_upperbodyheart, 0, x + 72 + sin(siner / 3.5) + 66 + ds1, (y - legh) + 134 + (cos(siner / 3.5) * 2) + 108 + ds2, 2, 2, 0, myblend, myalpha);
202
if (endface == 0)
203
{
204
    if (hurt == 0 && face_set == 0)
205
        draw_sprite_ext(spr_mettface1, faceno, x + 68, ((y + 40) - legh) + (cos(siner / 3.5) * 3), 2, 2, 0, myblend, myalpha);
206
    if (hurt == 0 && face_set == 1)
207
        draw_sprite_ext(spr_mettface_defeated, global.faceemotion, (x + 68) - ds1, (((y + 40) - legh) + (cos(siner / 3.5) * 3)) - ds2, 2, 2, 0, myblend, myalpha);
208
    if (hurt == 1)
209
        draw_sprite_ext(spr_mettface_hurt, hurtface, x + 68, ((y + 40) - legh) + (cos(siner / 3.5) * 3), 2, 2, 0, myblend, myalpha);
210
    if (hurt == 2)
211
        draw_sprite_ext(spr_mettface_defeated, global.faceemotion, (x + 68) - ds1, (((y + 40) - legh) + (cos(siner / 3.5) * 3)) - ds2, 2, 2, 0, myblend, myalpha);
212
}
213
else
214
{
215
    draw_sprite_ext(spr_mettface_general, global.faceemotion, x + 68, ((y + 40) - legh) + (cos(siner / 3.5) * 3), 2, 2, 0, myblend, myalpha);
216
}
217
if (noarm == 0)
218
{
219
    if (arml == 5)
220
        draw_sprite_ext(armlsprite, 0, x + 42 + sin(siner / 3.5), (y - legh) + 80 + (cos(siner / 3.5) * 2), 2, 2, 0, myblend, myalpha);
221
    if (armr == 5)
222
        draw_sprite_ext(armrsprite, 0, x + 110 + sin(siner / 3.5), (y - legh) + 80 + (cos(siner / 3.5) * 2), -2, 2, 0, myblend, myalpha);
223
}
224
if (pause == 1)
225
{
226
    if (hurt == 0)
227
    {
228
        hurt = 1;
229
        hurtface = choose(0, 1);
230
    }
231
}
232
if (pause == 2)
233
{
234
    if (hurt == 0)
235
    {
236
        hurt = 1;
237
        hurtface = 2;
238
    }
239
}
240
if (pause == 0)
241
    hurt = 0;
242
if (sineron == 1)
243
{
244
    y = obj_uborder.y - 136;
245
    if (global.idealborder[2] < 250)
246
    {
247
        if (legmode == 0)
248
        {
249
            depth = 0;
250
            legmode = 1;
251
            legl = choose(9, 10);
252
            legr = legl;
253
        }
254
    }
255
    else if (legmode == 1)
256
    {
257
        depth = 10;
258
        legmode = 0;
259
        event_user(0);
260
    }
261
}
262
if (fadewhite == 1)
263
{
264
    depth = -999999;
265
    whiteval += 0.2;
266
    draw_set_alpha(whiteval);
267
    draw_set_color(c_white);
268
    ossafe_fill_rectangle(-10, -10, 999, 999);
269
    if (whiteval > 10)
270
    {
271
        draw_set_alpha(-1 + (whiteval / 10));
272
        draw_set_color(c_black);
273
        ossafe_fill_rectangle(-10, -10, 999, 999);
274
    }
275
    if (whiteval == 10 && global.flag[425 killed_mettaton] == 1)
276
        snd_play(snd_vaporized);
277
    draw_set_alpha(1);
278
    if (whiteval >= 44)
279
    {
280
        instance_create(0, 0, obj_persistentfader);
281
        do_room_goto = true;
282
    }
283
}
284
if (noleg == 1)
285
{
286
    if (legrh > 6)
287
        legrh -= 4;
288
    else
289
        legrh = 6;
290
    if (leglh > 6)
291
        leglh -= 4;
292
    else
293
        leglh = 6;
294
    if (legh > 6)
295
        legh -= 4;
296
    else
297
        legh = 6;
298
}