Undertale script viewer

← back to main script listing

gml_Object_obj_gasterblaster_Draw_0

(view raw script w/o annotations or w/e)
1
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha);
2
if (con == 1 && skip == 0)
3
{
4
    x += floor((idealx - x) / 3);
5
    y += floor((idealy - y) / 3);
6
    if (x < idealx)
7
        x += 1;
8
    if (y < idealy)
9
        y += 1;
10
    if (x > idealx)
11
        x -= 1;
12
    if (y > idealy)
13
        y -= 1;
14
    if (abs(x - idealx) < 3)
15
        x = idealx;
16
    if (abs(y - idealy) < 3)
17
        y = idealy;
18
    if (abs(x - idealx) < 0.1 && abs(y - idealy) < 0.1)
19
    {
20
        con = 2;
21
        alarm[4] = 2;
22
    }
23
}
24
if (con == 1 && skip == 1)
25
{
26
    x += floor((idealx - x) / 3);
27
    y += floor((idealy - y) / 3);
28
    if (x < idealx)
29
        x += 1;
30
    if (y < idealy)
31
        y += 1;
32
    if (x > idealx)
33
        x -= 1;
34
    if (y > idealy)
35
        y -= 1;
36
    if (abs(x - idealx) < 3)
37
        x = idealx;
38
    if (abs(y - idealy) < 3)
39
        y = idealy;
40
    image_angle += floor((idealrot - image_angle) / 3);
41
    if (image_angle < idealrot)
42
        image_angle += 1;
43
    if (image_angle > idealrot)
44
        image_angle -= 1;
45
    if (abs(image_angle - idealrot) < 3)
46
        image_angle = idealrot;
47
    if (abs(x - idealx) < 0.1 && abs(y - idealy) < 0.1 && abs(idealrot - image_angle) < 0.01)
48
    {
49
        con = 4;
50
        alarm[4] = pause;
51
    }
52
}
53
if (con == 3)
54
{
55
    image_angle += floor((idealrot - image_angle) / 3);
56
    if (image_angle < idealrot)
57
        image_angle += 1;
58
    if (image_angle > idealrot)
59
        image_angle -= 1;
60
    if (abs(image_angle - idealrot) < 3)
61
        image_angle = idealrot;
62
    if (abs(idealrot - image_angle) < 0.01)
63
    {
64
        con = 4;
65
        alarm[4] = pause;
66
    }
67
}
68
if (con == 5)
69
{
70
    con = 6;
71
    alarm[4] = 4;
72
}
73
if (con == 6)
74
    image_index += 1;
75
if (con == 7)
76
{
77
    if (image_index == 4)
78
        image_index = 5;
79
    else if (image_index == 5)
80
        image_index = 4;
81
    direction = idealrot + 90;
82
    if (btimer == 0)
83
    {
84
        with (obj_sansb)
85
            p_beam = 1;
86
    }
87
    if (btimer == 0 && image_xscale >= 2)
88
    {
89
        sh = instance_create(0, 0, obj_sans_shaker);
90
        sh.intensity = 5;
91
    }
92
    btimer += 1;
93
    if (btimer < 5)
94
    {
95
        speed += 1;
96
        bt += floor((35 * image_xscale) / 4);
97
    }
98
    else
99
    {
100
        speed += 4;
101
    }
102
    if (btimer > (5 + terminal))
103
    {
104
        bt *= 0.8;
105
        fade -= 0.1;
106
        draw_set_alpha(fade);
107
        if (bt <= 2)
108
            instance_destroy();
109
    }
110
    if (x < -sprite_width)
111
        speed = 0;
112
    if (x > (room_width + sprite_width))
113
        speed = 0;
114
    if (y > (room_height + sprite_height))
115
        speed = 0;
116
    if (x < -sprite_height)
117
        speed = 0;
118
    bbsiner += 1;
119
    bb = (sin(bbsiner / 1.5) * bt) / 4;
120
    xx = lengthdir_x(70, image_angle - 90) * (image_xscale / 2);
121
    yy = lengthdir_y(70, image_angle - 90) * (image_xscale / 2);
122
    rr = random(2) - random(2);
123
    rr2 = random(2) - random(2);
124
    xxx = lengthdir_x(1000, image_angle - 90);
125
    yyy = lengthdir_y(1000, image_angle - 90);
126
    draw_set_color(c_white);
127
    draw_line_width(x + xx + rr, y + yy + rr2, x + xxx + rr, y + yyy + rr2, bt + bb);
128
    xxa = lengthdir_x(50, image_angle - 90) * (image_xscale / 2);
129
    yya = lengthdir_y(50, image_angle - 90) * (image_xscale / 2);
130
    xxb = lengthdir_x(60, image_angle - 90) * (image_xscale / 2);
131
    yyb = lengthdir_y(60, image_angle - 90) * (image_xscale / 2);
132
    draw_line_width(x + xx + rr, y + yy + rr2, x + xxa + rr, y + yya + rr2, (bt / 2) + bb);
133
    draw_line_width(x + xx + rr, y + yy + rr2, x + xxb + rr, y + yyb + rr2, (bt / 1.25) + bb);
134
    nx_factor = lengthdir_x(1, image_angle);
135
    ny_factor = lengthdir_y(1, image_angle);
136
    if (col_o == 1 && fade >= 0.8)
137
    {
138
        for (cl = 0; cl < 4; cl += 1)
139
        {
140
            if (collision_line((x + xx) - (((nx_factor * bt) / 2) * (cl / 4)), (y + yy) - (((ny_factor * bt) / 2) * (cl / 4)), (x + xxx) - (((nx_factor * bt) / 2) * (cl / 4)), (y + yyy) - (((ny_factor * bt) / 2) * (cl / 4)), obj_heart, false, true))
141
                event_user(7);
142
        }
143
        for (cl = 0; cl < 4; cl += 1)
144
        {
145
            if (collision_line(x + xx + (((nx_factor * bt) / 2) * (cl / 4)), y + yy + (((ny_factor * bt) / 2) * (cl / 4)), x + xxx + (((nx_factor * bt) / 2) * (cl / 4)), y + yyy + (((ny_factor * bt) / 2) * (cl / 4)), obj_heart, false, true))
146
                event_user(7);
147
        }
148
    }
149
    if (col_o == 0)
150
        col_o = 1;
151
    draw_set_alpha(1);
152
}