Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_climb_water_Draw_0

(view raw script w/o annotations or w/e)
1
var adjustment = 0;
2
if (i_ex(obj_rotating_tower_controller_new) && obj_rotating_tower_controller_new.appearance == 1)
3
    adjustment = 40;
4
var xx = x + adjustment;
5
var yy = y;
6
var xscale = 2;
7
var yscale = 2;
8
if (i_ex(obj_rotating_tower_controller_new))
9
{
10
    with (obj_rotating_tower_controller_new)
11
    {
12
        var _tilex = (xx / tile_width_fine) + 1;
13
        if (_tilex > (horizontaltilecount - 1))
14
            _tilex -= horizontaltilecount;
15
        if (_tilex < 0)
16
            _tilex += horizontaltilecount;
17
        var _tiley = other.y / tile_width_fine;
18
        xx = tower_x + tile_x[_tilex];
19
        xscale = (tile_xscale[_tilex] * 2) / tile_width_fine;
20
        if (tile_vis[_tilex] != 1)
21
            exit;
22
    }
23
}
24
if (watertype == 2)
25
{
26
    var topy = clamp(yy + drawy, ystart, endy);
27
    var boty = clamp((yy - 40) + (image_yscale * 40) + drawy, ystart, endy);
28
    var maxalpha = 1;
29
    if (boty >= endy)
30
    {
31
        var extratimer = (totaltimer - ((tilelimit + 2) * moverate)) * 2;
32
        boty += extratimer;
33
        maxalpha -= clamp(extratimer * 0.025, 0, 1);
34
    }
35
    var blend = clamp((boty - topy) / 50, 0, maxalpha);
36
    var merge = merge_color(c_black, c_white, blend);
37
    var mergeA = lerp(0, 1, blend);
38
    var drawcollision = true;
39
    if (drawcollision)
40
    {
41
    }
42
}
43
else if (watertype == 1)
44
{
45
    var watcol = 15317774;
46
    var topy = clamp(yy + drawy, ystart + 20, endy);
47
    var boty = clamp((yy - 40) + (image_yscale * 40) + drawy, ystart + 20, endy);
48
    var alph = clamp(animindex + (sin(animindex * 4) * 0.25), 0, 0.8);
49
    animindex += 0.25;
50
    col[0] = 15313408;
51
    col[1] = 15313408;
52
    col[2] = 15317774;
53
    col[3] = 15313408;
54
    col[4] = 15381248;
55
    var colindex = floor(animindex) % 4;
56
    watcol = col[colindex];
57
    var offset = -8;
58
    if (ending)
59
        offset = 0;
60
    var topcol = 16777215;
61
    if (instance_exists(obj_dw_cliff_precipice) && y > (endy - 80))
62
    {
63
        image_alpha -= 0.15;
64
        alph *= (image_alpha + 0.2);
65
        topcol = merge_color(c_black, c_white, image_alpha + 0.2);
66
        watcol = merge_color(c_black, watcol, image_alpha + 0.2);
67
    }
68
    draw_set_blend_mode(bm_add);
69
    draw_sprite_ext(spr_dw_church_watertile_top, colindex, xx, topy, xscale, 2, 0, topcol, alph);
70
    draw_sprite_ext(spr_pxwhite, 0, xx, topy, 20 * xscale, (boty - topy) + offset, 0, watcol, alph);
71
    if (!ending)
72
        draw_sprite_ext(spr_dw_church_watertile_top, colindex, xx, boty - 8, xscale, -2, 0, topcol, alph);
73
    draw_set_blend_mode(bm_normal);
74
    var drawcollision = false;
75
    if (drawcollision)
76
    {
77
        if (abs(boty - topy) > 20)
78
            draw_rectangle(xx + 8, topy + 8, (xx + 40) - 8, boty - 8, 1);
79
    }
80
}