Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_ceroba_phase_2_shield_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
var shield_health = 80;
4
switch (global.hotland_flag[2])
5
{
6
    case 2:
7
        shield_health = 90;
8
        break;
9
    case 3:
10
        shield_health = 100;
11
        break;
12
}
13
switch (scene)
14
{
15
    case -1:
16
        scene = 0;
17
        break;
18
    case 0:
19
        if (global.enemy_attack == "Ceroba Special Attack")
20
        {
21
            scene = -1;
22
            exit;
23
        }
24
        var fill_percentage_inc = 1 / shield_health;
25
        var collider_id = instance_place(x, y, obj_heart_yellow_shot);
26
        if (collider_id != -4)
27
        {
28
            audio_play_sound(snd_ceroba_shield_impact, 1, 0);
29
            instance_create_depth(collider_id.x, collider_id.y - collider_id.sprite_height, -999, obj_heart_yellow_shot_destroy);
30
            hit_show_timer = 30;
31
            bullet_hit_draw_timer = 5;
32
            if (fill_percentage < 1)
33
            {
34
                if (collider_id.object_index == obj_heart_yellow_shot_big)
35
                    fill_percentage += (fill_percentage_inc * 3);
36
                else
37
                    fill_percentage += fill_percentage_inc;
38
            }
39
            instance_destroy(collider_id);
40
        }
41
        if (variable_instance_exists(id, "bullet_hit_draw_timer"))
42
        {
43
            if (bullet_hit_draw_timer > 0)
44
                bullet_hit_draw_timer -= 1;
45
        }
46
        if (global.enemy_attacking)
47
            fill_percentage_current = lerp(fill_percentage_current, fill_percentage, 0.15);
48
        if (fill_percentage_current >= 0.99)
49
        {
50
            fill_percentage_current = 1;
51
            scene += 1;
52
            if (instance_exists(obj_battle_enemy_attack_ceroba_phase_2_attack_spawner))
53
            {
54
                with (obj_battle_enemy_attack_ceroba_phase_2_attack_spawner)
55
                {
56
                    alarm[0] = -1;
gml_Object_obj_ceroba_phase_2_shield_Alarm_0.gml

if (live_call()) return global.live_result; image_index = 0; image_speed = 1; alarm[0] = 50;
57
alarm[1]
58
                    event_user(0);
59
                }
60
            }
61
            else
62
            {
63
            }
64
        }
65
        break;
66
    case 1:
67
        image_alpha = 1;
68
        diamond_effect_alpha = 1;
69
        bullet_hit_draw_timer = 0;
70
        image_index = 0;
71
        image_speed = 1;
72
        scene++;
73
        break;
74
    case 2:
75
        diamond_effect_alpha -= 0.02;
76
        diamond_effect_scale += 0.1;
77
        if (diamond_effect_alpha <= 0)
78
            scene++;
79
        break;
80
    case 3:
81
        cutscene_wait(0.4);
82
        break;
83
    case 4:
84
        with (obj_heart_battle_fighting_yellow_final)
85
        {
86
            is_charging = false;
87
            moveable = false;
88
        }
89
        with (obj_heart_yellow_shot)
90
            instance_destroy();
91
        cutscene_wait(0.1);
92
        break;
93
    case 5:
94
        with (obj_ceroba_phase_2_bell)
95
            fade_in = 1;
96
        scene++;
97
        break;
98
    case 6:
99
        cutscene_wait(1);
100
        break;
101
    case 7:
102
        cutscene_advance();
103
        break;
104
    case 8:
105
        if (instance_exists(obj_battle_enemy_attack_ceroba_phase_2_attack_spawner))
106
        {
107
            with (obj_battle_enemy_attack_ceroba_phase_2_attack_spawner)
108
                instance_destroy();
109
        }
110
        else
111
        {
112
            with (obj_dialogue_box_battle_transformation_any)
113
                event_user(0);
114
        }
115
        if (global.enemy_attacking)
116
            obj_heart_battle_menu.image_alpha = 0;
117
        image_speed = 1;
118
        scene++;
119
        break;
120
    case 9:
121
        var execute_destroy = true;
122
        with (obj_ceroba_phase_2_bell)
123
        {
124
            if (bullet_destroy_self == false)
125
                execute_destroy = false;
126
        }
127
        if (execute_destroy == true)
128
        {
129
            if (instance_exists(obj_battle_enemy_attack_ceroba_phase_2_attack_spawner))
130
            {
131
                obj_battle_enemy_attack_ceroba_phase_2_attack_spawner.alarm[0] = -1;
132
                obj_battle_enemy_attack_ceroba_phase_2_attack_spawner.alarm[1] = -1;
133
            }
134
            instance_create_depth(x, y, depth, obj_ceroba_phase_2_shield_destroy);
135
            instance_destroy();
136
        }
137
        break;
138
}
139
var default_alpha = 0;
140
if (global.enemy_attacking == true && global.enemy_attack != "Ceroba Special Attack")
141
    default_alpha = 0.25;
142
if (hit_show_timer > 0)
143
{
144
    hit_show_timer--;
145
    image_alpha = lerp(image_alpha, 1, 0.15);
146
}
147
else
148
{
149
    image_alpha = lerp(image_alpha, default_alpha, 0.15);
150
}