Deltarune script viewer

← back to main script listing

gml_Object_obj_dmgwriter_ch1_Draw_0

(view raw script w/o annotations or w/e)
1
if (delaytimer < delay)
2
{
3
    with (obj_dmgwriter_ch1)
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
    message = specialmessage;
28
    if (damage == 0)
29
        message = 1;
30
    if (type == 4)
31
        message = 2;
32
    draw_set_font(global.damagefont);
33
    if (hspeed > 0)
34
        hspeed -= 1;
35
    if (hspeed < 0)
36
        hspeed += 1;
37
    if (abs(hspeed) < 1)
38
        hspeed = 0;
39
    if (message == 0)
40
    {
41
        draw_set_alpha(1 - kill);
42
        draw_set_halign(fa_right);
43
        if (spec == 0)
44
            draw_text_transformed(x + 30, y, string_hash_to_newline(string(damage)), 2 - stretch, stretch + kill, 0);
45
        if (spec == 1)
46
            draw_text_transformed(x + 30, y, string_hash_to_newline(string(damage)), 2 - stretch, stretch + kill, 90);
47
        draw_set_halign(fa_left);
48
        draw_set_alpha(1);
49
    }
50
    else
51
    {
52
        if (message == 1)
53
            draw_sprite_ext(spr_battlemsg_ch1, 0, x + 30, y, 2 - stretch, stretch + kill, 0, draw_get_color(), 1 - kill);
54
        if (message == 2)
55
            draw_sprite_ext(spr_battlemsg_ch1, 1, x + 30, y, 2 - stretch, stretch + kill, 0, c_red, 1 - kill);
56
        if (message == 3)
57
            draw_sprite_ext(spr_battlemsg_ch1, 2, x + 30, y, 2 - stretch, stretch + kill, 0, c_lime, 1 - kill);
58
        if (message == 4)
59
            draw_sprite_ext(spr_battlemsg_ch1, 3, x + 30, y, 2 - stretch, stretch + kill, 0, c_lime, 1 - kill);
60
    }
61
    if (bounces < 2)
62
        vspeed += 1;
63
    if (y > ystart && bounces < 2 && killactive == 0)
64
    {
65
        y = ystart;
66
        vspeed = vstart / 2;
67
        bounces += 1;
68
    }
69
    if (bounces >= 2 && killactive == 0)
70
    {
71
        vspeed = 0;
72
        y = ystart;
73
    }
74
    if (stretchgo == 1)
75
        stretch += 0.4;
76
    if (stretch >= 1.2)
77
    {
78
        stretch = 1;
79
        stretchgo = 0;
80
    }
81
    killtimer += 1;
82
    if (killtimer > 35)
83
        killactive = 1;
84
    if (killactive == 1)
85
    {
86
        kill += 0.08;
87
        y -= 4;
88
    }
89
    if (kill > 1)
90
        instance_destroy();
91
}