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