Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_fighting_red_Step_0

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