Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_ceroba_red_box_Step_0

(view raw script w/o annotations or w/e)
1
if instance_exists(obj_ceroba_body)
2
    var breath_percentage = (obj_ceroba_body.anim_stretch_current - 1) / (obj_ceroba_body.anim_stretch_max - 1)
3
else
4
{
5
    instance_destroy()
6
    return;
7
}
8
color_number_current = 200 - breath_percentage * 200
9
if instance_exists(obj_heart_battle_fighting_parent)
10
{
11
    if (obj_heart_battle_fighting_parent.bbox_left <= (obj_dialogue_box_battle_transformation_any.bbox_left + 5) || obj_heart_battle_fighting_parent.bbox_right >= (obj_dialogue_box_battle_transformation_any.bbox_right - 5) || obj_heart_battle_fighting_parent.bbox_bottom >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 5) || obj_heart_battle_fighting_parent.bbox_top <= (obj_dialogue_box_battle_transformation_any.bbox_top + 5))
12
    {
13
        if (obj_heart_battle_fighting_parent.vulnerable == true)
14
        {
15
            with (obj_heart_battle_fighting_parent)
16
            {
17
                if (global.current_pp_self > 0)
18
                {
19
                    instance_create(x, y, obj_heart_battle_effect_expand)
20
                    for (i = 0; i < 5; i++)
21
                        instance_create(x, y, obj_heart_battle_effect_shard)
22
                    global.current_pp_self -= 1
23
                    audio_play_sound(snd_mirrorbreak1, 20, false)
24
                }
25
                else
26
                {
27
                    global.max_hp_self -= 3
28
                    global.current_hp_self -= 3
29
                    audio_play_sound(snd_ceroba_hurt_red, 1, 0)
30
                }
31
                vulnerable = false
32
                global.hit_self = true
33
               alarm[0]
34
            }
35
        }
36
    }
37
}