Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_hand_Draw_0

(view raw script w/o annotations or w/e)
1
with (obj_mike_controller)
2
{
3
    if (!__usable)
4
        exit;
5
    if (instance_number(obj_encountermike) == 0 && instance_number(obj_mike_minigame_start) == 0 && instance_number(obj_micmenu) == 0 && (instance_number(obj_mike_attack_controller) == 0 || (!obj_mike_attack_controller.talking && obj_mike_attack_controller.action < 17)) && global.interact != 5)
6
    {
7
        if (type == 2 || type == 4 || type == 5 || type >= 7)
8
        {
9
            var shake = 0;
10
            var dist = point_distance(mx, my, x, y) / (hand_distance / 2);
11
            draw_set_colour(merge_colour(c_lime, c_yellow, dist));
12
            if (point_distance(x, y, mx, my) >= (hand_distance / 2))
13
            {
14
                dist = (point_distance(mx, my, x, y) - (hand_distance / 2)) / hand_distance;
15
                draw_set_colour(merge_colour(c_yellow, c_red, dist));
16
            }
17
            var tx = scr_mouse_x();
18
            var ty = scr_mouse_y();
19
            if (!global.use_mic)
20
            {
21
                tx = mx;
22
                ty = my;
23
            }
24
            if (ceil(point_distance(x, y, tx, ty)) >= hand_distance)
25
            {
26
                shake = 1;
27
                draw_set_colour(c_red);
28
            }
29
            if (!battle_active)
30
            {
31
                size1 = 8;
32
                if (ty < obj_mainchara.y && tx > (x - 60) && tx < (x + 50))
33
                    size1 = 30;
34
            }
35
            for (i = 1; i < (point_distance(mx, my, x, y) / 16); i++)
36
            {
37
                if (point_distance(mx + lengthdir_x(i * 16, point_direction(mx, my, x, y)), my + lengthdir_y(i * 16, point_direction(mx, my, x, y)), x, y) > (size1 * 1.5))
38
                {
39
                    if (battle_active)
40
                    {
41
                        d_circle(mx + (irandom_range(1, -1) * shake) + lengthdir_x(i * 16, point_direction(mx, my, x, y)), my + (irandom_range(1, -1) * shake) + lengthdir_y(i * 16, point_direction(mx, my, x, y)), 2, 1);
42
                    }
43
                    else
44
                    {
45
                        var randx = irandom_range(1, -1);
46
                        var randy = irandom_range(1, -1);
47
                        draw_set_colour(c_black);
48
                        d_circle(mx + (randx * shake) + lengthdir_x(i * 16, point_direction(mx, my, x, y)), my + (randy * shake) + lengthdir_y(i * 16, point_direction(mx, my, x, y)), 3, 0);
49
                        draw_set_colour(c_white);
50
                        d_circle(mx + (randx * shake) + lengthdir_x(i * 16, point_direction(mx, my, x, y)), my + (randy * shake) + lengthdir_y(i * 16, point_direction(mx, my, x, y)), 2, 0);
51
                    }
52
                }
53
            }
54
            var angle = point_direction(mx, my, x, y) + 90 + hand_angle;
55
            if (hand_type == 1 || hand_type == 6)
56
            {
57
                if (my > y)
58
                    angle = 180;
59
                else
60
                    angle = 0;
61
            }
62
            if (hand_type == 2 || hand_type == 3 || hand_type == 4)
63
                angle = 0;
64
            var _spr = hand_sprite[hand_type];
65
            with (obj_mike_minigame_controller)
66
            {
67
                if (phase == 2 && action == 1)
68
                {
69
                    switch (_spr)
70
                    {
71
                        case spr_mike_grab1:
72
                            _spr = spr_mike_grab1_outlined;
73
                            break;
74
                        case spr_mike_grab2:
75
                            _spr = spr_mike_grab2_outlined;
76
                            break;
77
                        case spr_mike_grab3:
78
                            _spr = spr_mike_grab3_outlined;
79
                            break;
80
                        case spr_mike_hand:
81
                            _spr = spr_mike_hand_outlined;
82
                            break;
83
                    }
84
                }
85
            }
86
            draw_sprite_ext(_spr, 0, mx + msx, my + msy, hand_xscale * 0.5, 0.5, angle, c_white, hand_speed);
87
            fruit_scale += ((fruit_scale2 - fruit_scale) * 0.25);
88
            fruit_scale2 += ((fruit_scale3 - fruit_scale2) * 0.25);
89
            if (fruit_scale > 0 && hand_fruit != -1)
90
                draw_sprite_ext(hand_fruit, current_time / 100, (mx + msx) - 6, (my + msy) - (fruit_scale * 32), fruit_scale, fruit_scale, 0, c_white, 1);
91
            if (point_distance(mx + msx, my + msy, scr_mouse_x(), scr_mouse_y()) > 64 && !(global.is_console || onSteamDeck()))
92
                draw_sprite_ext(spr_mouse, 0, scr_mouse_x(), scr_mouse_y(), 1, 1, 0, c_white, 1);
93
        }
94
        hand_shake -= 1;
95
        if (hand_shake > 0)
96
        {
97
            msx = -random_range(-2, 2);
98
            msy = -random_range(-2, 2);
99
        }
100
        if (hand_shake == 0 && hand_type == 3)
101
        {
102
            hand_type = 4;
103
            msx = 0;
104
            msy = 0;
105
            fruit_scale3 = 2;
106
            switch (obj_mike_attack_controller.pet_current[0])
107
            {
108
                case 1:
109
                    hand_fruit = 1555;
110
                    break;
111
                case 2:
112
                    hand_fruit = 2555;
113
                    break;
114
                case 3:
115
                default:
116
                    hand_fruit = 2287;
117
                    break;
118
            }
119
        }
120
        if (hand_shake == 0 && hand_type == 5)
121
        {
122
            hand_type = 0;
123
            msx = 0;
124
            msy = 0;
125
        }
126
        if (hand_shake < -60)
127
        {
128
            if (hand_type == 4)
129
            {
130
                hand_type = 0;
131
                fruit_scale3 = 0;
132
                fruit_scale2 = 0;
133
                fruit_scale = 0;
134
                hand_fruit = -1;
135
            }
136
        }
137
        else
138
        {
139
            fruit_scale3 = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(fruit_scale3, 1, 0.1);
140
        }
141
    }
142
}