Undertale Yellow script viewer

← back to main script listing

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