Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_dmgwriter_Draw_0

(view raw script w/o annotations or w/e)
1
if (delaytimer < delay)
2
{
3
    with (obj_dmgwriter)
4
        killtimer = 0;
5
}
6
delaytimer++;
7
mercytimer++;
8
if (delaytimer == delay)
9
{
10
    vspeed = -5 - random(2);
11
    hspeed = 10;
12
    vstart = vspeed;
13
    flip = 90;
14
}
15
if (delaytimer >= delay)
16
{
17
    draw_set_color(c_white);
18
    if (type == 0)
19
        draw_set_color(lightb);
20
    if (type == 1)
21
        draw_set_color(lightf);
22
    if (type == 1.5)
23
        draw_set_color(dkgreen);
24
    if (type == 2)
25
        draw_set_color(lightg);
26
    if (type == 3)
27
        draw_set_color(c_lime);
28
    if (type == 4)
29
        draw_set_color(c_red);
30
    if (type == 5 && damage < 0)
31
        draw_set_color(c_ltgray);
32
    if (type == 6)
33
        draw_set_color(lighty);
34
    message = specialmessage;
35
    if (damage == 0)
36
        message = 1;
37
    if (type == 4)
38
        message = 2;
39
    if (type == 5 && damage == 100)
40
        message = 5;
41
    if (type == 12)
42
        message = 10;
43
    if (type == 13)
44
    {
45
        message = 13;
46
        draw_set_color(aqcolor);
47
    }
48
    if (type == 14)
49
    {
50
        message = 14;
51
        draw_set_color(aqcolor);
52
    }
53
    if (type != 5)
54
        draw_set_font(global.damagefont);
55
    if (type == 5)
56
        draw_set_font(global.damagefontgold);
57
    if (hspeed > 0)
58
        hspeed -= 1;
59
    if (hspeed < 0)
60
        hspeed += 1;
61
    if (abs(hspeed) < 1)
62
        hspeed = 0;
63
    if (nohbounce)
64
        hspeed = 0;
65
    if (init == 0)
66
    {
67
        damagemessage = string(round(damage));
68
        if (type == 5)
69
            damagemessage = "+" + string(round(damage)) + "%";
70
        if (type == 5 && damage < 0)
71
            damagemessage = string(round(damage)) + "%";
72
        init = 1;
73
    }
74
    if (message == 0)
75
    {
76
        draw_set_alpha(1 - kill);
77
        draw_set_halign(fa_right);
78
        if (spec == 0)
79
            draw_text_transformed(x + 30, y, damagemessage, 2 - stretch, stretch + kill, 0);
80
        if (spec == 1)
81
            draw_text_transformed(x + 30, y, damagemessage, 2 - stretch, stretch + kill, 90);
82
        draw_set_halign(fa_left);
83
        draw_set_alpha(1);
84
    }
85
    else
86
    {
87
        if (message == 1)
88
            draw_sprite_ext(message_sprite, 0, x + 30, y, 2 - stretch, stretch + kill, 0, draw_get_color(), 1 - kill);
89
        if (message == 2)
90
            draw_sprite_ext(message_sprite, 1, x + 30, y, 2 - stretch, stretch + kill, 0, c_red, 1 - kill);
91
        if (message == 3)
92
            draw_sprite_ext(message_sprite, 2, x + 30, y, 2 - stretch, stretch + kill, 0, c_lime, 1 - kill);
93
        if (message == 4)
94
            draw_sprite_ext(message_sprite, 3, x + 30, y, 2 - stretch, stretch + kill, 0, c_lime, 1 - kill);
95
        if (message == 5)
96
            draw_sprite_ext(message_sprite, 5, x + 30, y, 2 - stretch, stretch + kill, 0, c_lime, 1 - kill);
97
        if (message == 6)
98
            draw_sprite_ext(message_sprite, 8, x + 30, y, 2 - stretch, stretch + kill, 0, c_white, 1 - kill);
99
        if (message == 7)
100
            draw_sprite_ext(message_sprite, 9, x + 30, y, 2 - stretch, stretch + kill, 0, c_white, 1 - kill);
101
        if (message == 8)
102
            draw_sprite_ext(message_sprite, 10, x + 30, y, 2 - stretch, stretch + kill, 0, c_white, 1 - kill);
103
        if (message == 9)
104
            draw_sprite_ext(message_sprite, 11, x + 30, y, 2 - stretch, stretch + kill, 0, c_white, 1 - kill);
105
        if (message == 10)
106
            draw_sprite_ext(message_sprite, 13, x + 30, y, 2 - stretch, stretch + kill, 0, c_red, 1 - kill);
107
        if (message == 13)
108
            draw_sprite_ext(message_sprite, 14, x + 30, y, 2 - stretch, stretch + kill, 0, aqcolor, 1 - kill);
109
        if (message == 14)
110
            draw_sprite_ext(message_sprite, 16, x + 30, y, 2 - stretch, stretch + kill, 0, aqcolor, 1 - kill);
111
    }
112
    if (bounces < 2)
113
        vspeed += 1;
114
    if (y > ystart && bounces < 2 && killactive == 0)
115
    {
116
        y = ystart;
117
        vspeed = vstart / 2;
118
        bounces += 1;
119
    }
120
    if (bounces >= 2 && killactive == 0)
121
    {
122
        vspeed = 0;
123
        y = ystart;
124
    }
125
    if (stretchgo == 1)
126
        stretch += 0.4;
127
    if (stretch >= 1.2)
128
    {
129
        stretch = 1;
130
        stretchgo = 0;
131
    }
132
    killtimer += 1;
133
    if (killtimer > 35)
134
        killactive = 1;
135
    if (killactive == 1)
136
    {
137
        kill += 0.08;
138
        y -= 4;
139
    }
140
    if (kill > 1)
141
        instance_destroy();
142
}
143
if (global.fighting == 1)
144
{
145
    if (stayincamera == 1)
146
    {
147
        if (x >= (xx + 600))
148
            x = xx + 600;
149
    }
150
}