Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_martlet_final_2_base_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
mask_index = spr_martlet_f2_torso;
4
if (martlet_sprites_reset == true)
5
{
6
    martlet_animation_enabled = true;
7
    martlet_sprites_reset = false;
8
    sprite_index = martlet_sprite_base;
9
    image_xscale = 1;
10
    image_yscale = 1;
11
}
12
if (sprite_index == martlet_sprite_base)
13
{
14
    with (obj_martlet_body_part_base)
15
        visible = true;
16
}
17
else
18
{
19
    if (sprite_index != spr_martlet_f2_start)
20
        image_speed = 1;
21
    martlet_animation_enabled = false;
22
    with (obj_martlet_body_part_base)
23
        visible = false;
24
}
25
if (martlet_animation_enabled == true)
26
{
27
    no_loop = false;
28
    sin_timer += 33;
29
    if (sin_timer > 2000000)
30
        sin_timer = 0;
31
    image_angle = cos(current_time / 750) * -3;
32
    y = ystart + (cos(current_time / 750) * 3);
33
    x = xstart + damage_disjoint_x;
34
    with (martlet_head)
35
    {
36
        y = ystart + (cos(current_time / 750) * 3);
37
        x = xstart + (cos(current_time / 750) * 3) + other.damage_disjoint_x;
38
    }
39
    with (martlet_hair)
40
    {
41
        y = ystart + (cos(current_time / 750) * 3);
42
        x = xstart + (cos(current_time / 750) * 3) + other.damage_disjoint_x;
43
    }
44
    with (martlet_fist_left)
45
    {
46
        y = ystart + (cos(current_time / 750) * 2);
47
        x = xstart + (sin(current_time / 750) * 2) + other.damage_disjoint_x;
48
        image_angle = cos(current_time / 750) * 8;
49
    }
50
    with (martlet_fist_right)
51
    {
52
        y = ystart + (cos(current_time / 750) * 4);
53
        x = xstart + (sin(current_time / 900) * 4) + other.damage_disjoint_x;
54
        image_angle = cos(current_time / 900) * 6;
55
    }
56
    with (martlet_legs)
57
    {
58
        image_xscale = 1 + (sin(current_time / 750) * 0.02);
59
        x = xstart + other.damage_disjoint_x;
60
    }
61
}
62
else if (!no_loop)
63
{
64
    no_loop = true;
65
    sin_timer = 0;
66
    image_angle = 0;
67
    y = lerp(y, ystart, 0.25);
68
    x = lerp(x, xstart, 0.25);
69
}
70
else
71
{
72
    x = xstart + damage_disjoint_x;
73
}
74
if (damage_disjoint_count > 0)
75
    damage_disjoint_count -= 1;
76
if (instance_exists(obj_text_damage_count) && global.fight_number == 1 && no_loop_damage_disjoint_count == false)
77
{
78
    damage_disjoint_count = 12;
79
    no_loop_damage_disjoint_count = true;
80
}
81
else if (!instance_exists(obj_text_damage_count))
82
{
83
    no_loop_damage_disjoint_count = false;
84
}
85
if (damage_disjoint_count == 12)
86
    damage_disjoint_x = -50;
87
else if (damage_disjoint_count == 10)
88
    damage_disjoint_x = 50;
89
else if (damage_disjoint_count == 8)
90
    damage_disjoint_x = -20;
91
else if (damage_disjoint_count == 6)
92
    damage_disjoint_x = 20;
93
else if (damage_disjoint_count == 4)
94
    damage_disjoint_x = -10;
95
else if (damage_disjoint_count == 2)
96
    damage_disjoint_x = 10;
97
else if (damage_disjoint_count == 0)
98
    damage_disjoint_x = 0;
99
if (martlet_target_melt_sprite != martlet_previous_melt_sprite && martlet_previous_melt_sprite_alpha == 0)
100
{
101
    sprite_index = martlet_target_melt_sprite;
102
    martlet_previous_melt_sprite_alpha = 1;
103
}
104
martlet_previous_melt_sprite_alpha = lerp(martlet_previous_melt_sprite_alpha, 0, 0.1);
105
if (martlet_previous_melt_sprite_alpha <= 0.1)
106
{
107
    martlet_previous_melt_sprite_alpha = 0;
108
    martlet_previous_melt_sprite = martlet_target_melt_sprite;
109
}
110
if (healthbar_timer > 0)
111
    healthbar_timer--;
112
else if (healthbar_alpha > 0)
113
    healthbar_alpha -= 0.1;
114
if (damage_flash_timer > 0)
115
    damage_flash_timer -= 1;
116
if (image_alpha > 0)
117
{
118
    with (obj_heart_yellow_shot)
119
    {
120
        if (place_meeting(x, y, obj_martlet_final_2_base))
121
        {
122
            other.healthbar_timer = other.healthbar_timer_max;
123
            other.healthbar_alpha = 1;
124
            other.damage_flash_timer = 3;
125
            var shot_damage = 3;
126
            global.current_hp_enemy = clamp(global.current_hp_enemy - shot_damage, 1, 9999);
127
            global.current_hp_enemy_draw = global.current_hp_enemy;
128
            audio_play_sound(snd_arc_hit, 0.1, 0);
129
            if (object_index != obj_heart_yellow_shot_blast_collider)
130
                instance_destroy();
131
        }
132
    }
133
}