Undertale script viewer

← back to main script listing

gml_Object_obj_bonestab_Draw_0

(view raw script w/o annotations or w/e)
1
if (active == 1)
2
{
3
    warning -= 1;
4
    if (warning > 0)
5
    {
6
        if (dir == 0)
7
        {
8
            wx = global.idealborder[0] + 8;
9
            wx2 = global.idealborder[1] - 3;
10
            wy = global.idealborder[3] - 3;
11
            wy2 = global.idealborder[3] - height;
12
        }
13
        if (dir == 1)
14
        {
15
            wx = global.idealborder[1] - height;
16
            wx2 = global.idealborder[1] - 3;
17
            wy = global.idealborder[2] + 8;
18
            wy2 = global.idealborder[3] - 3;
19
        }
20
        if (dir == 2)
21
        {
22
            wx = global.idealborder[0] + 8;
23
            wx2 = global.idealborder[1] - 3;
24
            wy = global.idealborder[2] + 6;
25
            wy2 = global.idealborder[2] + 5 + height;
26
        }
27
        if (dir == 3)
28
        {
29
            wx = global.idealborder[0] + 5 + height;
30
            wx2 = global.idealborder[0] + 8;
31
            wy = global.idealborder[2] + 8;
32
            wy2 = global.idealborder[3] - 3;
33
        }
34
        draw_set_color(c_red);
35
        draw_rectangle(wx, wy, wx2, wy2, true);
36
    }
37
    else
38
    {
39
        draw_self_border();
40
        if (con == 1)
41
            con = 2;
42
    }
43
}
44
if (con == 2)
45
{
46
    if (timer == 0)
47
        snd_play(snd_spearrise);
48
    if (timer >= 0 && timer <= 2)
49
    {
50
        if (dir == 0)
51
            y -= floor(height / 3);
52
        if (dir == 1)
53
            x -= floor(height / 3);
54
        if (dir == 2)
55
            y += floor(height / 3);
56
        if (dir == 3)
57
            x += floor(height / 3);
58
    }
59
    if (timer == 3)
60
    {
61
        if (dir == 0)
62
            cosm_y -= floor(height / 5);
63
        if (dir == 1)
64
            cosm_x -= floor(height / 5);
65
        if (dir == 2)
66
            cosm_y += floor(height / 5);
67
        if (dir == 3)
68
            cosm_x += floor(height / 5);
69
    }
70
    if (timer == 4)
71
    {
72
        cosm_x = 0;
73
        cosm_y = 0;
74
    }
75
    if (retain >= 0)
76
    {
77
        if (timer >= 4 && timer <= 8)
78
        {
79
            rr = random(racket) - random(racket);
80
            rr2 = random(racket) - random(racket);
81
            if (racket > 1)
82
                racket -= 1;
83
            if (timer == 9)
84
                rr = 0;
85
            if (timer == 9)
86
                rr2 = 0;
87
            if (dir == 0)
88
            {
89
                y = (ideal_y - height) + rr;
90
                x = ideal_x + rr2;
91
            }
92
            if (dir == 1)
93
            {
94
                y = ideal_y + rr;
95
                x = (ideal_x - height) + rr2;
96
            }
97
            if (dir == 2)
98
            {
99
                y = ideal_y + height + rr;
100
                x = ideal_x + rr2;
101
            }
102
            if (dir == 3)
103
            {
104
                y = ideal_y + rr;
105
                x = ideal_x + height + rr2;
106
            }
107
        }
108
    }
109
    if (timer >= (9 + retain))
110
    {
111
        if (dir == 0)
112
        {
113
            y += floor(height / 4);
114
            if (y > ideal_y)
115
                instance_destroy();
116
        }
117
        if (dir == 1)
118
        {
119
            x += floor(height / 4);
120
            if (x > ideal_x)
121
                instance_destroy();
122
        }
123
        if (dir == 2)
124
        {
125
            y -= floor(height / 4);
126
            if (y < ideal_y)
127
                instance_destroy();
128
        }
129
        if (dir == 3)
130
        {
131
            x -= floor(height / 4);
132
            if (x < ideal_x)
133
                instance_destroy();
134
        }
135
    }
136
    timer += 1;
137
}