Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_sweet_corn_cob_b_Step_0

(view raw script w/o annotations or w/e)
1
var enemy_dead_2 = global.enemy_dead_2
2
var enemy_spared_2 = global.enemy_spared_2
3
if (enemy_dead_2 == false && enemy_spared_2 == false)
4
    image_alpha = global.image_alpha_enemy_attacking
5
if (enemy_dead_2 == true)
6
{
7
    instance_destroy()
8
    return;
9
}
10
else if (enemy_spared_2 == true)
11
{
12
    x = starting_point_x
13
    y = starting_point_y
14
    image_alpha = 0.5
15
    if (no_loop_create_clouds == false)
16
    {
17
        for (i = 0; i <= 11; i += 1)
18
            instance_create(x, (y - 60), obj_spare_cloud)
19
    }
20
    no_loop_create_clouds = true
21
    instance_destroy()
22
    return;
23
}
24
if (damage_disjoint_count > 0)
25
    damage_disjoint_count -= 1
26
else if (enemy_dead_2 == false && enemy_spared_2 == false)
27
{
28
    if (global.enemy_low_hp_2 == true && global.current_hp_enemy_2 < global.max_hp_enemy_2)
29
        sprite_index = spr_sweet_corn_cob_critical
30
    else
31
        sprite_index = spr_sweet_corn_cob
32
}
33
if (instance_exists(obj_text_damage_count) && global.fight_number == 2 && no_loop_damage_disjoint_count == false)
34
{
35
    time_elapsed_x = 0
36
    time_elapsed_y = 0
37
    sign_modifier = -1
38
    damage_disjoint_count = 12
39
    no_loop_damage_disjoint_count = true
40
    audio_play_sound(enemy_hurt_noise, 1, 0, 1, 0, enemy_hurt_pitch)
41
}
42
else if (!instance_exists(obj_text_damage_count))
43
    no_loop_damage_disjoint_count = false
44
if (damage_disjoint_count == 12)
45
    damage_disjoint_x = -50
46
else if (damage_disjoint_count == 10)
47
    damage_disjoint_x = 50
48
else if (damage_disjoint_count == 8)
49
    damage_disjoint_x = -20
50
else if (damage_disjoint_count == 6)
51
    damage_disjoint_x = 20
52
else if (damage_disjoint_count == 4)
53
    damage_disjoint_x = -10
54
else if (damage_disjoint_count == 2)
55
    damage_disjoint_x = 10
56
else if (damage_disjoint_count == 0)
57
    damage_disjoint_x = 0
58
if (damage_disjoint_count > 0 || global.current_hp_enemy_2 <= 0)
59
    image_alpha = 0
60
x = draw_position_x + damage_disjoint_x
61
y = draw_position_y + damage_disjoint_y
62
if ((!((instance_exists(obj_text_damage_count) && global.fight_number == 2))) && enemy_dead_2 == false && enemy_spared_2 == false)
63
{
64
    game_maker_cannot_do_math = power((time_elapsed / (time_max / 2 * (1 / sqrt(max_rise))) - sqrt(max_rise)), 2)
65
    animation_disjoint_y = sign_modifier * (max_rise - round(game_maker_cannot_do_math))
66
    time_elapsed += time_increase
67
    if (time_elapsed >= time_max)
68
        time_elapsed = 0
69
    y = draw_position_y + animation_disjoint_y
70
}
71
else
72
{
73
    time_elapsed = 11
74
    game_maker_cannot_do_math = power((time_elapsed / (time_max / 2 * (1 / sqrt(max_rise))) - sqrt(max_rise)), 2)
75
    animation_disjoint_y = sign_modifier * (max_rise - round(game_maker_cannot_do_math))
76
    y = draw_position_y + animation_disjoint_y
77
}