Undertale script viewer

← back to main script listing

gml_Object_obj_creditbullet_Draw_0

(view raw script w/o annotations or w/e)
1
if (active == 1)
2
{
3
    if (stretch == 0)
4
    {
5
        draw_set_halign(fa_center);
6
        xx = lengthdir_x(width * 1, image_angle);
7
        yy = lengthdir_y(width * 1, image_angle);
8
        xx_off = lengthdir_x(1, image_angle - 90) * 18;
9
        yy_off = lengthdir_y(1, image_angle - 90) * 18;
10
        if (hitted == 0)
11
        {
12
            if (collision_line(x - (xx * 0.8), y - (yy * 0.8), x + (xx * 0.8), y + (yy * 0.8), obj_creditsheart, true, true))
13
                event_user(1);
14
        }
15
        draw_set_font(fnt_maintext);
16
        draw_set_color(c_white);
17
        if (hitted == 1)
18
            draw_set_color(c_yellow);
19
        draw_text_transformed(x - xx_off, y - yy_off, text, 2, 2, image_angle);
20
        draw_set_color(c_red);
21
        draw_set_halign(fa_left);
22
    }
23
    if (stretch == 1)
24
    {
25
        draw_set_halign(fa_center);
26
        xx = lengthdir_x(width * 1, image_angle);
27
        yy = lengthdir_y(width * 1, image_angle);
28
        s_factor = 1;
29
        if ((x - xx) < 0)
30
        {
31
            s_loss = abs(x - xx);
32
            s_factor = (width - s_loss) / width;
33
        }
34
        if ((x + xx) > room_width)
35
        {
36
            s_loss = abs((x + xx) - room_width);
37
            s_factor = (width - s_loss) / width;
38
        }
39
        xx *= s_factor;
40
        xx_off = lengthdir_x(1, image_angle - 90) * 18 * s_factor;
41
        yy_off = lengthdir_y(1, image_angle - 90) * 18;
42
        if (hitted == 0)
43
        {
44
            if (collision_line(x - (xx * 0.8), y - (yy * 0.8), x + (xx * 0.8), y + (yy * 0.8), obj_creditsheart, true, true))
45
                event_user(1);
46
        }
47
        draw_set_font(fnt_maintext);
48
        draw_set_color(c_white);
49
        if (hitted == 1)
50
            draw_set_color(c_yellow);
51
        draw_text_transformed(x - xx_off, y - yy_off, text, 2 * s_factor, 2, image_angle);
52
        draw_set_halign(fa_left);
53
    }
54
    if (stretch == 2)
55
    {
56
        draw_set_halign(fa_center);
57
        s_factor = 1;
58
        s_factor = stretchfactor / width;
59
        xx = lengthdir_x(width * 1 * s_factor, image_angle);
60
        yy = lengthdir_y(width * 1 * s_factor, image_angle);
61
        xx_off = lengthdir_x(1, image_angle - 90) * 18;
62
        yy_off = lengthdir_y(1, image_angle - 90) * 18;
63
        if (hitted == 0)
64
        {
65
            if (collision_line(x - (xx * 0.8), y - (yy * 0.8), x + (xx * 0.8), y + (yy * 0.8), obj_creditsheart, true, true))
66
                event_user(1);
67
        }
68
        draw_set_font(fnt_maintext);
69
        draw_set_color(c_white);
70
        if (hitted == 1)
71
            draw_set_color(c_yellow);
72
        draw_text_transformed(x - xx_off, y - yy_off, text, 2 * s_factor, 2, image_angle);
73
        draw_set_halign(fa_left);
74
    }
75
}