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
14
switch scene
15
{
16
    case -1:
17
        scene = 0
18
        break
19
    case 0:
20
        if (global.enemy_attack == "Ceroba Special Attack")
21
        {
22
            scene = -1
23
            return;
24
        }
25
        var fill_percentage_inc = 1 / shield_health
26
        var collider_id = instance_place(x, y, obj_heart_yellow_shot)
27
        if (collider_id != noone)
28
        {
29
            audio_play_sound(snd_ceroba_shield_impact, 1, 0)
30
            instance_create_depth(collider_id.x, (collider_id.y - collider_id.sprite_height), -999, obj_heart_yellow_shot_destroy)
31
            hit_show_timer = 30
32
            bullet_hit_draw_timer = 5
33
            if (fill_percentage < 1)
34
            {
35
                if (collider_id.object_index == obj_heart_yellow_shot_big)
36
                    fill_percentage += (fill_percentage_inc * 3)
37
                else
38
                    fill_percentage += fill_percentage_inc
39
            }
40
            instance_destroy(collider_id)
41
        }
42
        if variable_instance_exists(id, "bullet_hit_draw_timer")
43
        {
44
            if (bullet_hit_draw_timer > 0)
45
                bullet_hit_draw_timer -= 1
46
        }
47
        if global.enemy_attacking
48
            fill_percentage_current = lerp(fill_percentage_current, fill_percentage, 0.15)
49
        if (fill_percentage_current >= 0.99)
50
        {
51
            fill_percentage_current = 1
52
            scene += 1
53
            if instance_exists(obj_battle_enemy_attack_ceroba_phase_2_attack_spawner)
54
            {
55
                with (obj_battle_enemy_attack_ceroba_phase_2_attack_spawner)
56
                {
57
                    alarm[0] = -1
alarm[0]

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