Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_fighting_red_slippery_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
script_execute(scr_controls_battle_heart_red);
4
x_previous = x;
5
y_previous = y;
6
move_x = key_left + key_right;
7
move_y = key_down + key_up;
8
hsp = move_x * walk_speed;
9
vsp = move_y * walk_speed;
10
if (key_revert)
11
{
12
    if (speed_sound_noloop == false)
13
    {
14
        speed_sound_noloop = true;
15
        if (!instance_exists(obj_quote_bubble_battle))
16
        {
17
        }
18
    }
19
    hsp = round(hsp / 2);
20
    vsp = round(vsp / 2);
21
}
22
else if (speed_sound_noloop == true)
23
{
24
    speed_sound_noloop = false;
25
}
26
var lerp_amount_h;
27
if (hsp != 0)
28
    lerp_amount_h = 0.2;
29
else
30
    lerp_amount_h = 0.05;
31
var lerp_amount_v;
32
if (vsp != 0)
33
    lerp_amount_v = 0.2;
34
else
35
    lerp_amount_v = 0.05;
36
hsp_current = lerp(hsp_current, hsp, lerp_amount_h);
37
vsp_current = lerp(vsp_current, vsp, lerp_amount_v);
38
hsp += hsp_factor;
39
vsp += vsp_factor;
40
if (sign(hsp_current) == -1 && (bbox_left + hsp_current) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
41
{
42
    while ((bbox_left + sign(hsp_current)) > (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
43
        x += sign(hsp_current);
44
    hsp = 0;
45
    hsp_current = 0;
46
}
47
else if (sign(hsp_current) == 1 && (bbox_right + hsp_current) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
48
{
49
    while ((bbox_right + sign(hsp_current)) < (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
50
        x += sign(hsp_current);
51
    hsp = 0;
52
    hsp_current = 0;
53
}
54
x += hsp_current;
55
if (sign(vsp_current) == -1 && (bbox_top + vsp_current) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
56
{
57
    while ((bbox_top + sign(vsp_current)) > (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
58
        y += sign(vsp_current);
59
    vsp = 0;
60
    vsp_current = 0;
61
}
62
else if (sign(vsp_current) == 1 && (bbox_bottom + vsp_current) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
63
{
64
    while ((bbox_bottom + sign(vsp_current)) < (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
65
        y += sign(vsp_current);
66
    vsp = 0;
67
    vsp_current = 0;
68
}
69
y += vsp_current;
70
obj_heart_red_hitbox.x = x;
71
obj_heart_red_hitbox.y = y;
72
if (instance_exists(obj_heart_battle_effect_glow))
73
{
74
    obj_heart_battle_effect_glow.x = x;
75
    obj_heart_battle_effect_glow.y = y;
76
}
77
if (moveable == true && global.current_sp_self > 0)
78
{
79
    var can_trail = false;
80
    trail_cc_current += 1;
81
    if (trail_cc_current >= trail_cc_max)
82
    {
83
        can_trail = true;
84
        trail_cc_current = 0;
85
    }
86
    if (can_trail == true)
87
    {
88
        ds_list_add(x_list, x);
89
        ds_list_add(y_list, y);
90
        while (ds_list_size(x_list) > max_points_trail)
91
        {
92
            ds_list_delete(x_list, 0);
93
            ds_list_delete(y_list, 0);
94
        }
95
    }
96
}
97
event_user(15);