Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_battlealphaer_Draw_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    init = 1;
4
    if (fadeplease == 1)
5
    {
6
        tile_layer_amount = 777777;
7
        alpha_changed = 0;
8
        tile_fade = 1;
9
        tilearray = tile_get_ids_at_depth(tile_layer_amount);
10
        for (var i = 0; i < array_length_1d(tilearray); i++)
11
            tile_set_alpha(tilearray[i], 0);
12
    }
13
}
14
var target = 1198;
15
if (!i_ex(obj_mainchara))
16
    target = 1660;
17
if (!i_ex(target))
18
    exit;
19
cur_alpha = battlealpha;
20
if (autobattle == 1)
21
{
22
    if (instance_exists(obj_overworldbulletparent))
23
        target.battlemode = 1;
24
    else
25
        target.battlemode = 0;
26
}
27
var should_fade = true;
28
with (obj_mainchara)
29
{
30
    if (holding_item != -4)
31
        should_fade = false;
32
}
33
if (target.battlemode == 1 && should_fade)
34
{
35
    if (battlealpha < 0.5)
36
        battlealpha += 0.04;
37
}
38
else if (battlealpha > 0)
39
{
40
    battlealpha -= 0.04;
41
}
42
if (tile_fade == 1)
43
{
44
    if (cur_alpha != battlealpha)
45
    {
46
        for (var i = 0; i < array_length_1d(tilearray); i++)
47
            tile_set_alpha(tilearray[i], battlealpha * 2);
48
    }
49
}
50
draw_set_alpha(battlealpha);
51
draw_set_color(c_black);
52
draw_rectangle(__view_get(e__VW.XView, 0) - 100, __view_get(e__VW.YView, 0) - 100, __view_get(e__VW.XView, 0) + 740, __view_get(e__VW.YView, 0) + 540, false);
53
draw_set_alpha(1);
54
if (instance_exists(obj_caterpillarchara))
55
{
56
    obj_caterpillarchara.image_blend = merge_color(c_white, c_black, battlealpha);
57
    if (battlealpha <= 0)
58
        obj_caterpillarchara.image_blend = c_white;
59
}
60
with (obj_caterpillar_dash)
61
{
62
    image_blend = merge_color(c_white, c_black, other.battlealpha);
63
    if (other.battlealpha <= 0)
64
        image_blend = c_white;
65
}
66
67
enum e__VW
68
{
69
    XView,
70
    YView,
71
    WView,
72
    HView,
73
    Angle,
74
    HBorder,
75
    VBorder,
76
    HSpeed,
77
    VSpeed,
78
    Object,
79
    Visible,
80
    XPort,
81
    YPort,
82
    WPort,
83
    HPort,
84
    Camera,
85
    SurfaceID
86
}