Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_tensionbar_Draw_0

(view raw script w/o annotations or w/e)
1
draw_sprite(spr_tplogo, 0, x - 30, y + 30);
2
draw_sprite(spr_tensionbar, 1, x, y);
3
draw_set_color(c_white);
4
scr_84_set_draw_font
scr_84_set_draw_font

function scr_84_set_draw_font(arg0) { global.chemg_font = arg0; draw_set_font(scr_84_get_font(arg0)); }
("mainbig");
5
flashsiner += 1;
6
tamt = floor((apparent / global.maxtension) * 100);
7
maxed = 0;
8
if (tamt < 100)
9
{
10
    draw_text(x - 30, y + 70, string_hash_to_newline(floor((apparent / global.maxtension) * 100)));
11
    draw_text(x - 25, y + 95, string_hash_to_newline("%"));
12
}
13
if (tamt >= 100)
14
{
15
    maxed = 1;
16
    draw_set_color(c_yellow);
17
    draw_text(x - 28, y + 70, string_hash_to_newline("M"));
18
    draw_text(x - 24, y + 90, string_hash_to_newline("A"));
19
    draw_text(x - 20, y + 110, string_hash_to_newline("X"));
20
}
21
if (abs(apparent - global.tension) < 20)
22
    apparent = global.tension;
23
if (apparent < global.tension)
24
    apparent += 20;
25
if (apparent > global.tension)
26
    apparent -= 20;
27
if (apparent != current)
28
{
29
    changetimer += 1;
30
    if (changetimer > 15)
31
    {
32
        if ((apparent - current) > 0)
33
            current += 2;
34
        if ((apparent - current) > 10)
35
            current += 2;
36
        if ((apparent - current) > 25)
37
            current += 3;
38
        if ((apparent - current) > 50)
39
            current += 4;
40
        if ((apparent - current) > 100)
41
            current += 5;
42
        if ((apparent - current) < 0)
43
            current -= 2;
44
        if ((apparent - current) < -10)
45
            current -= 2;
46
        if ((apparent - current) < -25)
47
            current -= 3;
48
        if ((apparent - current) < -50)
49
            current -= 4;
50
        if ((apparent - current) < -100)
51
            current -= 5;
52
        if (abs(apparent - current) < 3)
53
            current = apparent;
54
    }
55
}
56
if (current > 0)
57
{
58
    if (apparent < current)
59
    {
60
        draw_set_color(c_red);
61
        draw_rectangle(x + 3, (y + sprite_height) - 1, (x + sprite_width) - 1, (y + sprite_height) - ((current / global.maxtension) * sprite_height), false);
62
        draw_set_color(c_orange);
63
        draw_rectangle(x + 3, (y + sprite_height) - 1, (x + sprite_width) - 1, (y + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
64
    }
65
    if (apparent > current)
66
    {
67
        draw_set_color(c_white);
68
        draw_rectangle(x + 3, (y + sprite_height) - 1, (x + sprite_width) - 1, (y + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
69
        draw_set_color(c_orange);
70
        if (maxed == 1)
71
            draw_set_color(merge_color(c_yellow, c_orange, 0.5));
72
        draw_rectangle(x + 3, (y + sprite_height) - 1, (x + sprite_width) - 1, (y + sprite_height) - ((current / global.maxtension) * sprite_height), false);
73
    }
74
    if (apparent == current)
75
    {
76
        draw_set_color(c_orange);
77
        if (maxed == 1)
78
            draw_set_color(merge_color(c_yellow, c_orange, 0.5));
79
        draw_rectangle(x + 3, (y + sprite_height) - 1, (x + sprite_width) - 1, (y + sprite_height) - ((current / global.maxtension) * sprite_height), false);
80
    }
81
}
82
if (global.tensionselect > 0)
83
{
84
    tsiner += 1;
85
    draw_set_color(c_white);
86
    draw_set_alpha(abs(sin(tsiner / 8) * 0.5) + 0.2);
87
    theight = (y + sprite_height) - ((current / global.maxtension) * sprite_height);
88
    theight2 = theight + ((global.tensionselect / global.maxtension) * sprite_height);
89
    if (theight2 > ((y + sprite_height) - 1))
90
    {
91
        theight2 = (y + sprite_height) - 1;
92
        draw_set_color(c_dkgray);
93
        draw_set_alpha(0.7);
94
    }
95
    draw_rectangle(x + 3, theight2, (x + sprite_width) - 1, theight, false);
96
    draw_set_alpha(1);
97
}
98
if (apparent > 20 && apparent < global.maxtension)
99
    draw_sprite(spr_tensionmarker, 0, x + 3, (y + sprite_height) - ((current / global.maxtension) * sprite_height));
100
draw_sprite(spr_tensionbar, 0, x, y);