Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_tensionbar_Draw_0

(view raw script w/o annotations or w/e)
1
if (global.chapter == 2 && instance_exists(obj_gigaqueen_enemy))
2
{
3
    if (obj_battlecontroller.gigaqueencon != 0)
4
        exit;
5
}
6
if (!surface_exists(healthbar_surf))
7
    healthbar_surf = surface_create(96, 250);
8
surface_set_target(healthbar_surf);
9
draw_clear_alpha(c_white, 0);
10
yy = __view_get(e__VW.YView, 0);
11
y = yy + 40;
12
draw_sprite(spr_tensionbar, 1, 0, 0);
13
if (abs(apparent - global.tension) < 20)
14
    apparent = global.tension;
15
if (apparent < global.tension)
16
    apparent += 20;
17
if (apparent > global.tension)
18
    apparent -= 20;
19
if (apparent != current)
20
{
21
    changetimer += 1;
22
    if (changetimer > 15)
23
    {
24
        if ((apparent - current) > 0)
25
            current += 2;
26
        if ((apparent - current) > 10)
27
            current += 2;
28
        if ((apparent - current) > 25)
29
            current += 3;
30
        if ((apparent - current) > 50)
31
            current += 4;
32
        if ((apparent - current) > 100)
33
            current += 5;
34
        if ((apparent - current) < 0)
35
            current -= 2;
36
        if ((apparent - current) < -10)
37
            current -= 2;
38
        if ((apparent - current) < -25)
39
            current -= 3;
40
        if ((apparent - current) < -50)
41
            current -= 4;
42
        if ((apparent - current) < -100)
43
            current -= 5;
44
        if (abs(apparent - current) < 3)
45
            current = apparent;
46
    }
47
}
48
if (current > 0)
49
{
50
    if (apparent < current)
51
    {
52
        draw_set_color(c_red);
53
        draw_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
54
        draw_set_color(c_orange);
55
        draw_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
56
    }
57
    if (apparent > current)
58
    {
59
        draw_set_color(c_white);
60
        draw_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((apparent / global.maxtension) * sprite_height), false);
61
        draw_set_color(c_orange);
62
        if (maxed == 1)
63
            draw_set_color(merge_color(c_yellow, c_orange, 0.5));
64
        draw_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
65
    }
66
    if (apparent == current)
67
    {
68
        draw_set_color(c_orange);
69
        if (maxed == 1)
70
            draw_set_color(merge_color(c_yellow, c_orange, 0.5));
71
        draw_rectangle(3, (0 + sprite_height) - 1, (0 + sprite_width) - 1, (0 + sprite_height) - ((current / global.maxtension) * sprite_height), false);
72
    }
73
}
74
shit = 0;
75
try
76
{
77
    if (global.tensionselect >= 0)
78
        shit = 1;
79
}
80
catch (_ex)
81
{
82
    shit = 2;
83
}
84
if (shit == 2)
85
    snd_play(snd_splat);
86
if (global.tensionselect > 0)
87
{
88
    tsiner += 1;
89
    draw_set_color(c_white);
90
    draw_set_alpha(abs(sin(tsiner / 8) * 0.5) + 0.2);
91
    theight = (0 + sprite_height) - ((current / global.maxtension) * sprite_height);
92
    theight2 = theight + ((global.tensionselect / global.maxtension) * sprite_height);
93
    if (theight2 > ((0 + sprite_height) - 1))
94
    {
95
        theight2 = (0 + sprite_height) - 1;
96
        draw_set_color(c_dkgray);
97
        draw_set_alpha(0.7);
98
    }
99
    draw_rectangle(3, theight2, (0 + sprite_width) - 1, theight, false);
100
    draw_set_alpha(1);
101
}
102
if (apparent > 20 && apparent < global.maxtension)
103
    draw_sprite(spr_tensionmarker, 0, 3, (0 + sprite_height) - ((current / global.maxtension) * sprite_height));
104
draw_sprite(spr_tensionbar, 0, 0, 0);
105
gpu_set_blendmode(bm_subtract);
106
draw_sprite_ext(spr_tensionbar_cutout, 0, 0, 0, 1, 1, 0, c_white, 1);
107
gpu_set_blendmode(bm_normal);
108
surface_reset_target();
109
draw_surface(healthbar_surf, x, y);
110
draw_sprite(spr_tplogo, 0, x - 30, y + 30);
111
draw_set_color(c_white);
112
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");
113
flashsiner += 1;
114
tamt = floor((apparent / global.maxtension) * 100);
115
maxed = 0;
116
if (tamt < 100)
117
{
118
    draw_text(x - 30, y + 70, string_hash_to_newline(string(floor((apparent / global.maxtension) * 100))));
119
    draw_text(x - 25, y + 95, string_hash_to_newline(stringsetloc(
Close Message
"%", "obj_tensionbar_slash_Draw_0_gml_18_0"
)));
120
}
121
if (tamt >= 100)
122
{
123
    maxed = 1;
124
    draw_set_color(c_yellow);
125
    draw_text(x - 28, y + 70, string_hash_to_newline(stringsetloc(
M
"M", "obj_tensionbar_slash_Draw_0_gml_25_0"
)));
126
    draw_text(x - 24, y + 90, string_hash_to_newline(stringsetloc(
A
"A", "obj_tensionbar_slash_Draw_0_gml_26_0"
)));
127
    draw_text(x - 20, y + 110, string_hash_to_newline(stringsetloc(
X
"X", "obj_tensionbar_slash_Draw_0_gml_27_0"
)));
128
}
129
130
enum e__VW
131
{
132
    XView,
133
    YView,
134
    WView,
135
    HView,
136
    Angle,
137
    HBorder,
138
    VBorder,
139
    HSpeed,
140
    VSpeed,
141
    Object,
142
    Visible,
143
    XPort,
144
    YPort,
145
    WPort,
146
    HPort,
147
    Camera,
148
    SurfaceID
149
}