Deltarune (Chapter 4) 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
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
5
{
6
    if (keyboard_check_pressed(ord("V")))
7
        dodraw = !dodraw;
8
    if (i_ex(obj_rotating_tower_controller_new))
9
        dodraw = obj_rotating_tower_controller_new.dodraw;
10
}
11
var found = 0;
12
var _alph;
13
if (!onrotatingtower && jumpchargecon)
14
{
15
    var count = 1;
16
    if (jumpchargetimer >= chargetime1)
17
        count = 2;
18
    if (jumpchargetimer >= chargetime2)
19
        count = 3;
20
    var px = x;
21
    var py = y;
22
    for (var i = 1; i < (count + 1); i++)
23
    {
24
        with (instance_place(px, py, obj_climbstarter))
25
        {
26
            if ((other.dir == 2 && e_up) || (other.dir == 0 && e_down) || (other.dir == 3 && e_left) || (other.dir == 1 && e_right))
27
            {
28
                found = i;
29
                break;
30
            }
31
        }
32
        if (dir == 0)
33
            py = y + (40 * i);
34
        if (dir == 1)
35
            px = x + (40 * i);
36
        if (dir == 2)
37
            py = y - (40 * i);
38
        if (dir == 3)
39
            px = x - (40 * i);
40
        if (place_meeting(px, py, obj_climb_climbable))
41
            found = i;
42
    }
43
    _alph = clamp(jumpchargetimer / 14, 0.1, 0.8);
44
    var angle = 0;
45
    var xoff = 0;
46
    var yoff = 0;
47
    if (dir == 0)
48
    {
49
        angle = 0;
50
        xoff = -22;
51
        yoff = 18;
52
    }
53
    if (dir == 1)
54
    {
55
        angle = 90;
56
        xoff = 18;
57
        yoff = 22;
58
    }
59
    if (dir == 2)
60
    {
61
        angle = 180;
62
        xoff = 22;
63
        yoff = -18;
64
    }
65
    if (dir == 3)
66
    {
67
        angle = 270;
68
        xoff = -18;
69
        yoff = -22;
70
    }
71
    var col = reticle_hint_col_inactive;
72
    if (found)
73
        col = reticle_hint_col_active;
74
    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);
75
}
76
if (dodraw)
77
    draw_sprite_ext(sprite_index, image_index, x + drawx, y + drawy + drawoffsety, image_xscale, image_yscale, image_angle, image_blend, tempalpha * image_alpha);
78
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
79
{
80
    var count = 0;
81
    var space = 10;
82
    var border = 8;
83
}
84
var drawreticle = true;
85
if (drawreticle)
86
{
87
    if (jumpchargecon)
88
    {
89
        if (!onrotatingtower)
90
        {
91
            if (found)
92
            {
93
                var px = x - 20;
94
                var py = y - 20;
95
                if (dir == 0)
96
                    py += (40 * found);
97
                if (dir == 1)
98
                    px += (40 * found);
99
                if (dir == 2)
100
                    py -= (40 * found);
101
                if (dir == 3)
102
                    px -= (40 * found);
103
                var col = merge_color(c_yellow, c_white, 0.4 + (sin(jumpchargetimer / 3) * 0.4));
104
                if (dodraw)
105
                    draw_sprite_ext(spr_climb_reticle, 0, px + 0, py + 0, 2, 2, 0, col, _alph);
106
            }
107
        }
108
    }
109
}