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