Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_cactony_body_a_Step_0

(view raw script w/o annotations or w/e)
1
var enemy_dead = global.enemy_dead;
2
var enemy_spared = global.enemy_spared;
3
var enemy_sparing = global.enemy_sparing;
4
if (enemy_dead == false && enemy_spared == false)
5
    image_alpha = global.image_alpha_enemy_attacking;
6
if (enemy_dead == true)
7
{
8
    x = starting_point_x;
9
    y = starting_point_y;
10
    image_xscale = starting_point_xscale;
11
    image_yscale = starting_point_yscale;
12
    instance_create(starting_point_x, starting_point_y, obj_cactony_dead);
13
    instance_destroy();
14
    exit;
15
    image_alpha = 0.5;
16
}
17
else if (enemy_spared == true)
18
{
19
    sprite_index = spr_cactony_spared;
20
    x = starting_point_x;
21
    y = starting_point_y;
22
    image_xscale = starting_point_xscale;
23
    image_yscale = starting_point_yscale;
24
    image_speed = 0;
25
    image_index = 0;
26
    image_alpha = 0.5;
27
    if (no_loop_create_clouds == false)
28
    {
29
        for (i = 0; i <= 11; i += 1)
30
            instance_create(x, y - 22, obj_spare_cloud);
31
    }
32
    no_loop_create_clouds = true;
33
}
34
if (damage_disjoint_count > 0)
35
{
36
    damage_disjoint_count -= 1;
37
}
38
else if (enemy_dead == false && enemy_spared == false && damage_disjoint_count <= 0)
39
{
40
    if (global.enemy_low_hp == true && global.current_hp_enemy < global.max_hp_enemy)
41
    {
42
        sprite_index = spr_cactony_body_critical;
43
        time_max = time_max_critical;
44
        time_mult = time_mult_normal;
45
    }
46
    else if (enemy_sparing == true)
47
    {
48
        sprite_index = spr_cactony_body_loved;
49
        time_max = time_max_normal;
50
        time_mult = time_mult_loved;
51
    }
52
    else
53
    {
54
        sprite_index = spr_cactony_body_normal;
55
        time_max = time_max_normal;
56
        time_mult = time_mult_normal;
57
    }
58
}
59
if (instance_exists(obj_text_damage_count) && global.fight_number == 1 && no_loop_damage_disjoint_count == false)
60
{
61
    time_elapsed = 0;
62
    sign_modifier = 1;
63
    damage_disjoint_count = 12;
64
    no_loop_damage_disjoint_count = true;
65
    audio_play_sound(enemy_hurt_noise, 1, 0, 1, 0, enemy_hurt_pitch);
66
}
67
else if (!instance_exists(obj_text_damage_count))
68
{
69
    no_loop_damage_disjoint_count = false;
70
}
71
if (damage_disjoint_count == 12)
72
    damage_disjoint_x = -50;
73
else if (damage_disjoint_count == 10)
74
    damage_disjoint_x = 50;
75
else if (damage_disjoint_count == 8)
76
    damage_disjoint_x = -20;
77
else if (damage_disjoint_count == 6)
78
    damage_disjoint_x = 20;
79
else if (damage_disjoint_count == 4)
80
    damage_disjoint_x = -10;
81
else if (damage_disjoint_count == 2)
82
    damage_disjoint_x = 10;
83
else if (damage_disjoint_count == 0)
84
    damage_disjoint_x = 0;
85
if (damage_disjoint_count > 0 || global.current_hp_enemy <= 0)
86
    sprite_index = spr_cactony_dead;
87
x = draw_position_x + damage_disjoint_x;
88
y = draw_position_y + damage_disjoint_y;
89
image_xscale = starting_point_xscale;
90
image_yscale = starting_point_yscale;
91
if (!(instance_exists(obj_text_damage_count) && global.fight_number == 1) && enemy_dead == false && enemy_spared == false)
92
{
93
    for (i = 0; i < time_mult; i++)
94
    {
95
        game_maker_cannot_do_math = power((time_elapsed / ((time_max / 2) * (1 / sqrt(max_rise)))) - sqrt(max_rise), 2);
96
        animation_disjoint_yscale = sign_modifier * (max_rise - game_maker_cannot_do_math);
97
        image_yscale = draw_position_yscale + animation_disjoint_yscale;
98
        image_xscale = draw_position_xscale - (animation_disjoint_yscale * (max_rise_ext / max_rise));
99
        time_elapsed += time_increase;
100
        if (time_elapsed >= time_max)
101
        {
102
            time_elapsed = 0;
103
            sign_modifier = -sign_modifier;
104
        }
105
    }
106
    animating = true;
107
}
108
else
109
{
110
    animating = false;
111
}
112
with (obj_cactony_body_shadow_a)
113
    event_user(0);