Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dunebud_a_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
if (sinking_away == false)
4
{
5
    var enemy_dead = global.enemy_dead;
6
    var enemy_spared = global.enemy_spared;
7
    event_user(0);
8
    if (enemy_dead == true)
9
    {
10
        x = starting_point_x;
11
        y = starting_point_y;
12
        image_xscale = starting_point_xscale;
13
        image_yscale = starting_point_yscale;
14
        instance_create(starting_point_x, starting_point_y, obj_dunebud_dead);
15
        instance_destroy();
16
        exit;
17
        image_alpha = 0.5;
18
    }
19
    else if (enemy_spared == true)
20
    {
21
        sprite_index = spr_dunebud_spared;
22
        x = starting_point_x;
23
        y = starting_point_y;
24
        image_xscale = starting_point_xscale;
25
        image_yscale = starting_point_yscale;
26
        image_speed = 0;
27
        image_index = 0;
28
        image_alpha = 0.5;
29
        if (no_loop_create_clouds == false)
30
        {
31
            for (i = 0; i <= 11; i += 1)
32
                instance_create(x, y - 22, obj_spare_cloud);
33
        }
34
        no_loop_create_clouds = true;
35
    }
36
    if (damage_disjoint_count > 0)
37
    {
38
        damage_disjoint_count -= 1;
39
    }
40
    else if (enemy_dead == false && enemy_spared == false && damage_disjoint_count <= 0)
41
    {
42
        var can_change = false;
43
        if (image_alpha == 0)
44
        {
45
            image_speed = 0;
46
            image_index = 0;
47
            was_invisible = true;
48
        }
49
        else if (was_invisible == true)
50
        {
51
            can_change = true;
52
            was_invisible = false;
53
        }
54
        if (global.enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy)
55
        {
56
            if (sprite_index != spr_dunebud_critical || can_change == true)
57
            {
58
                sprite_index = spr_dunebud_critical;
59
                image_speed = 0;
60
                image_index = 0;
61
                time_max = time_max_critical;
62
            }
63
        }
64
        else if (sprite_index != spr_dunebud_normal || can_change == true)
65
        {
66
            sprite_index = spr_dunebud_normal;
67
            image_speed = image_speed_normal;
68
            image_index = 0;
69
            time_max = time_max_normal;
70
        }
71
    }
72
    if (instance_exists(obj_text_damage_count) && global.fight_number == 1 && no_loop_damage_disjoint_count == false)
73
    {
74
        time_elapsed = 0;
75
        sign_modifier = 1;
76
        damage_disjoint_count = 12;
77
        no_loop_damage_disjoint_count = true;
78
        audio_play_sound(enemy_hurt_noise, 1, 0, 1, 0, enemy_hurt_pitch);
79
    }
80
    else if (!instance_exists(obj_text_damage_count))
81
    {
82
        no_loop_damage_disjoint_count = false;
83
    }
84
    if (damage_disjoint_count == 12)
85
        damage_disjoint_x = -50;
86
    else if (damage_disjoint_count == 10)
87
        damage_disjoint_x = 50;
88
    else if (damage_disjoint_count == 8)
89
        damage_disjoint_x = -20;
90
    else if (damage_disjoint_count == 6)
91
        damage_disjoint_x = 20;
92
    else if (damage_disjoint_count == 4)
93
        damage_disjoint_x = -10;
94
    else if (damage_disjoint_count == 2)
95
        damage_disjoint_x = 10;
96
    else if (damage_disjoint_count == 0)
97
        damage_disjoint_x = 0;
98
    if (damage_disjoint_count > 0 || global.current_hp_enemy <= 0)
99
    {
100
        if (sprite_index != spr_dunebud_dead)
101
        {
102
            sprite_index = spr_dunebud_dead;
103
            image_xscale = starting_point_xscale;
104
            image_yscale = starting_point_yscale;
105
            if (damage_disjoint_count > 0)
106
                image_speed = image_speed_dead;
107
            else
108
                image_speed = 0;
109
            image_index = 0;
110
        }
111
    }
112
    x = draw_position_x + damage_disjoint_x;
113
    y = draw_position_y + damage_disjoint_y;
114
    image_xscale = starting_point_xscale;
115
    image_yscale = starting_point_yscale;
116
    if (!(instance_exists(obj_text_damage_count) && global.fight_number == 1) && enemy_dead == false && enemy_spared == false && sinking_away == false && image_alpha > 0)
117
    {
118
        game_maker_cannot_do_math = power((time_elapsed / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2);
119
        animation_disjoint_yscale = sign_modifier * (max_rise - game_maker_cannot_do_math);
120
        time_elapsed += time_increase;
121
        if (time_elapsed >= time_max)
122
        {
123
            time_elapsed = 0;
124
            sign_modifier = -sign_modifier;
125
        }
126
        image_yscale = draw_position_yscale + animation_disjoint_yscale;
127
        image_xscale = draw_position_xscale - (animation_disjoint_yscale * (max_rise_ext / max_rise));
128
        animating = true;
129
    }
130
    else
131
    {
132
        animating = false;
133
    }
134
}
135
else
136
{
137
    animating = false;
138
}