Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_fighting_blue_down_Step_0

(view raw script w/o annotations or w/e)
1
var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
2
if (damage < 1)
3
    damage = 1
4
script_execute(gml_Script_scr_controls_battle_heart_blue_down)
5
move_x = key_left + key_right
6
hsp = move_x * walk_speed
7
if key_revert
8
    hsp = round(hsp / 2)
9
if (vsp < 20 && floating == false)
10
    vsp += grav
11
if (key_up_release && vsp < 0)
12
{
13
    vsp = 0
14
    floating = true
15
    alarm[1] = 3
alarm[1]

floating = false
16
}
17
if ((bbox_bottom + 1) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
18
{
19
    floating = false
20
    alarm[1] = 0
alarm[1]

floating = false
21
    vsp = key_up * (-jumpspeed)
22
}
23
else if (place_meeting(x, (y + 1), obj_battle_enemy_attack_platform_parent) && (!(box_collision(x, y, obj_battle_enemy_attack_platform_parent))))
24
{
25
    floating = false
26
    alarm[1] = 0
alarm[1]

floating = false
27
    vsp = key_up * (-jumpspeed)
28
}
29
if ((!(place_meeting(x, (y + 1), obj_battle_enemy_attack_platform_parent))) || box_collision(x, y, obj_battle_enemy_attack_platform_parent))
30
    hsp_carry = 0
31
if (sign(hsp) == -1 && (bbox_left + hsp) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
32
{
33
    while ((bbox_left + sign(hsp)) > (obj_dialogue_box_battle_transformation_any.bbox_left + 4))
34
        x += sign(hsp)
35
    hsp = 0
36
}
37
else if (sign(hsp) == 1 && (bbox_right + hsp) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
38
{
39
    while ((bbox_right + sign(hsp)) < (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
40
        x += sign(hsp)
41
    hsp = 0
42
}
43
x += (hsp + hsp_carry)
44
if (sign(vsp) == -1 && (bbox_top + vsp) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
45
{
46
    while ((bbox_top + sign(vsp)) > (obj_dialogue_box_battle_transformation_any.bbox_top + 4))
47
        y += sign(vsp)
48
    vsp = 0
49
}
50
else if (sign(vsp) == 1 && (bbox_bottom + vsp) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
51
{
52
    while ((bbox_bottom + sign(vsp)) < (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
53
        y += sign(vsp)
54
    vsp = 0
55
}
56
else if instance_exists(obj_battle_enemy_attack_platform_parent)
57
{
58
    if (!(box_collision(x, y, obj_battle_enemy_attack_platform_parent)))
59
    {
60
        if (place_meeting(x, (y_position + vsp), obj_battle_enemy_attack_platform_parent) && vsp >= 0)
61
        {
62
            while (!(place_meeting(x, (y_position + sign(vsp)), obj_battle_enemy_attack_platform_parent)))
63
            {
64
                y_position += (sign(vsp) / 2)
65
                y = floor(y_position + 0.5)
66
            }
67
            vsp = 0
68
        }
69
    }
70
}
71
y_position += vsp
72
y = floor(y_position + 0.5)
73
if (vulnerable == true)
74
{
75
    if place_meeting(x, y, obj_battle_enemy_attack_parent)
76
    {
77
        vulnerable = false
78
        global.hit_self = true
79
        global.current_hp_self -= damage
80
        audio_play_sound(snd_hurt, 20, false)
81
        alarm[0] = global.invulnerability_self
alarm[0]

vulnerable = true
82
    }
83
    if (place_meeting(x, y, obj_battle_enemy_attack_orange_parent) && hsp == 0 && vsp == 0)
84
    {
85
        vulnerable = false
86
        global.hit_self = true
87
        global.current_hp_self -= damage
88
        audio_play_sound(snd_hurt, 20, false)
89
        alarm[0] = global.invulnerability_self
alarm[0]

vulnerable = true
90
    }
91
    if (place_meeting(x, y, obj_battle_enemy_attack_blue_parent) && (hsp != 0 || vsp != 0))
92
    {
93
        vulnerable = false
94
        global.hit_self = true
95
        global.current_hp_self -= damage
96
        audio_play_sound(snd_hurt, 20, false)
97
        alarm[0] = global.invulnerability_self
alarm[0]

vulnerable = true
98
    }
99
}
100
if (vulnerable == false)
101
    image_speed = 1
102
else
103
{
104
    image_speed = 0
105
    image_index = 0
106
}
107
if (global.current_hp_self < 0)
108
    global.current_hp_self = 0
109
if (global.current_hp_self == 0)
110
{
111
    global.heart_battle_fighting_color = "red"
112
    global.heart_battle_fighting_x = x
113
    global.heart_battle_fighting_y = y
114
    with (obj_battle_generator)
115
        audio_extend = false
116
    audio_stop_all()
117
    room_goto(rm_death_screen Death screen)
118
}