Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_climb_kris_Draw_0

(view raw script w/o annotations or w/e)
1
var tempalpha = 1;
2
if (global.inv > 0)
3
    tempalpha = 0.5;
4
var found = 0;
5
var _alph;
6
if (!onrotatingtower && jumpchargecon)
7
{
8
    var count = 1;
9
    if (jumpchargetimer >= chargetime1)
10
        count = 2;
11
    if (jumpchargetimer >= chargetime2)
12
        count = 3;
13
    var px = x;
14
    var py = y;
15
    for (var i = 1; i < (count + 1); i++)
16
    {
17
        with (instance_place(px, py, obj_climbstarter))
18
        {
19
            if ((other.dir == 2 && e_up) || (other.dir == 0 && e_down) || (other.dir == 3 && e_left) || (other.dir == 1 && e_right))
20
            {
21
                found = i;
22
                break;
23
            }
24
        }
25
        if (dir == 0)
26
            py = y + (40 * i);
27
        if (dir == 1)
28
            px = x + (40 * i);
29
        if (dir == 2)
30
            py = y - (40 * i);
31
        if (dir == 3)
32
            px = x - (40 * i);
33
        if (place_meeting(px, py, obj_climb_jumpblocker))
34
            break;
35
        if (place_meeting(px, py, obj_climb_climbable))
36
            found = i;
37
    }
38
    _alph = clamp(jumpchargetimer / 14, 0.1, 0.8);
39
    var angle = 0;
40
    var xoff = 0;
41
    var yoff = 0;
42
    if (dir == 0)
43
    {
44
        angle = 0;
45
        xoff = -22;
46
        yoff = 18;
47
    }
48
    if (dir == 1)
49
    {
50
        angle = 90;
51
        xoff = 18;
52
        yoff = 22;
53
    }
54
    if (dir == 2)
55
    {
56
        angle = 180;
57
        xoff = 22;
58
        yoff = -18;
59
    }
60
    if (dir == 3)
61
    {
62
        angle = 270;
63
        xoff = -18;
64
        yoff = -22;
65
    }
66
    var col = reticle_hint_col_inactive;
67
    if (found)
68
        col = reticle_hint_col_active;
69
    draw_sprite_general(spr_climb_reticle_hint, floor(current_time * 0.5) % 4, 0, 0, 22, (jumpchargetimer / chargetime2) * 62, x + xoff, y + yoff, 2, 2, angle, col, col, col, col, 0.85);
70
}
71
if (dodraw)
72
    draw_sprite_ext(sprite_index, image_index, x + drawx, y + drawy + drawoffsety, image_xscale, image_yscale, image_angle, image_blend, tempalpha * image_alpha);
73
var drawreticle = true;
74
if (drawreticle)
75
{
76
    if (jumpchargecon)
77
    {
78
        if (!onrotatingtower)
79
        {
80
            if (found)
81
            {
82
                var px = x - 20;
83
                var py = y - 20;
84
                if (dir == 0)
85
                    py += (40 * found);
86
                if (dir == 1)
87
                    px += (40 * found);
88
                if (dir == 2)
89
                    py -= (40 * found);
90
                if (dir == 3)
91
                    px -= (40 * found);
92
                var col = merge_color(c_yellow, c_white, 0.4 + (sin(jumpchargetimer / 3) * 0.4));
93
                if (dodraw)
94
                    draw_sprite_ext(spr_climb_reticle, 0, px + 0, py + 0, 2, 2, 0, col, _alph);
95
            }
96
        }
97
    }
98
}