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(gml_Script_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
    speed_sound_noloop = false
24
if (hsp != 0)
25
    var lerp_amount_h = 0.2
26
else
27
    lerp_amount_h = 0.05
28
if (vsp != 0)
29
    var lerp_amount_v = 0.2
30
else
31
    lerp_amount_v = 0.05
32
hsp_current = lerp(hsp_current, hsp, lerp_amount_h)
33
vsp_current = lerp(vsp_current, vsp, lerp_amount_v)
34
hsp += hsp_factor
35
vsp += vsp_factor
36
if (sign(hsp_current) == -1 && (bbox_left + hsp_current) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
37
{
38
    while ((bbox_left + sign(hsp_current)) > (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
39
        x += sign(hsp_current)
40
    hsp = 0
41
    hsp_current = 0
42
}
43
else if (sign(hsp_current) == 1 && (bbox_right + hsp_current) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
44
{
45
    while ((bbox_right + sign(hsp_current)) < (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
46
        x += sign(hsp_current)
47
    hsp = 0
48
    hsp_current = 0
49
}
50
x += hsp_current
51
if (sign(vsp_current) == -1 && (bbox_top + vsp_current) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
52
{
53
    while ((bbox_top + sign(vsp_current)) > (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
54
        y += sign(vsp_current)
55
    vsp = 0
56
    vsp_current = 0
57
}
58
else if (sign(vsp_current) == 1 && (bbox_bottom + vsp_current) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
59
{
60
    while ((bbox_bottom + sign(vsp_current)) < (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
61
        y += sign(vsp_current)
62
    vsp = 0
63
    vsp_current = 0
64
}
65
y += vsp_current
66
obj_heart_red_hitbox.x = x
67
obj_heart_red_hitbox.y = y
68
if instance_exists(obj_heart_battle_effect_glow)
69
{
70
    obj_heart_battle_effect_glow.x = x
71
    obj_heart_battle_effect_glow.y = y
72
}
73
if (moveable == true && global.current_sp_self > 0)
74
{
75
    var can_trail = false
76
    trail_cc_current += 1
77
    if (trail_cc_current >= trail_cc_max)
78
    {
79
        can_trail = true
80
        trail_cc_current = 0
81
    }
82
    if (can_trail == true)
83
    {
84
        ds_list_add(x_list, x)
85
        ds_list_add(y_list, y)
86
        while (ds_list_size(x_list) > max_points_trail)
87
        {
88
            ds_list_delete(x_list, 0)
89
            ds_list_delete(y_list, 0)
90
        }
91
    }
92
}
93
event_user(15)