Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_martlet_final_base_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (martlet_sprites_reset == true)
4
{
5
    martlet_animation_enabled = true
6
    martlet_sprites_reset = false
7
    sprite_index = martlet_sprite_base
8
    image_xscale = 1
9
    image_yscale = 1
10
}
11
if (sprite_index == martlet_sprite_base)
12
{
13
    if surface_exists(wing_surf)
14
        surface_free(wing_surf)
15
    with (obj_martlet_body_part_base)
16
    {
17
        image_angle = other.image_angle
18
        y = other.y
19
        x = other.x
20
        visible = true
21
        image_speed = other.speed_multiplier
22
    }
23
}
24
else
25
{
26
    martlet_animation_enabled = false
27
    with (obj_martlet_body_part_base)
28
    {
29
        image_angle = other.image_angle
30
        image_yscale = 1
31
        y = other.y
32
        x = other.x
33
        visible = false
34
        if (object_index == obj_martlet_final_hair && other.sprite_index == spr_martlet_final_scream)
35
            visible = true
36
    }
37
}
38
if (martlet_animation_enabled == true)
39
{
40
    var _speed_multiplier = speed_multiplier
41
    no_loop = false
42
    sin_timer += (33 * _speed_multiplier)
43
    if (sin_timer > 2000000)
44
        sin_timer = 0
45
    image_angle = 0 + (sin(sin_timer / 1000)) * 5
46
    y = martlet_y_target + (sin(sin_timer / 500)) * 20
47
    x = xstart + (sin(sin_timer / 2000)) * 40
48
    with (obj_martlet_final_leg_front)
49
    {
50
        var scale_modif = (cos(current_time / 500)) * 0.04
51
        image_yscale = 1 + scale_modif * _speed_multiplier
52
        var y_modif = (cos(current_time / 500)) * 2
53
        y += (y_modif * _speed_multiplier)
54
    }
55
    with (obj_martlet_final_talon_front)
56
    {
57
        scale_modif = (cos(current_time / 500)) * 0.04
58
        image_yscale = 1 + scale_modif * _speed_multiplier
59
        y_modif = (cos(current_time / 500)) * 3
60
        y += (y_modif * _speed_multiplier)
61
    }
62
    with (obj_martlet_final_leg_back)
63
    {
64
        scale_modif = (cos(current_time / 750)) * 0.04
65
        image_yscale = 1 + scale_modif * _speed_multiplier
66
        y_modif = (cos(current_time / 750)) * 1
67
        y += (y_modif * _speed_multiplier)
68
    }
69
    with (obj_martlet_final_talon_back)
70
    {
71
        scale_modif = (cos(current_time / 750)) * 0.04
72
        image_yscale = 1 + scale_modif * _speed_multiplier
73
        y_modif = (cos(current_time / 300)) * 2
74
        y += (y_modif * _speed_multiplier)
75
    }
76
    with (obj_martlet_final_head)
77
    {
78
        y_modif = (cos(current_time / 1000)) * 3
79
        y += (y_modif * _speed_multiplier)
80
    }
81
    with (obj_martlet_final_hair)
82
    {
83
        y_modif = (cos(current_time / 1000)) * 3
84
        y += (y_modif * _speed_multiplier)
85
    }
86
}
87
else if (!no_loop)
88
{
89
    no_loop = true
90
    sin_timer = 0
91
    image_angle = lerp(image_angle, 0, 0.25)
92
    y = lerp(y, martlet_y_target, 0.25)
93
    x = lerp(x, xstart, 0.25)
94
}
95
if (healthbar_timer > 0)
96
    healthbar_timer--
97
else if (healthbar_alpha > 0)
98
    healthbar_alpha -= 0.1
99
if (damage_flash_timer > 0)
100
    damage_flash_timer -= 1
101
if ((sprite_index == martlet_sprite_base || sprite_index == spr_martlet_final_wing_attack) && image_alpha > 0)
102
{
103
    with (obj_heart_yellow_shot)
104
    {
105
        if (place_meeting(x, y, obj_martlet_final_base) || place_meeting(x, y, obj_martlet_final_wing))
106
        {
107
            other.healthbar_timer = other.healthbar_timer_max
108
            other.healthbar_alpha = 1
109
            other.damage_flash_timer = 3
110
            var shot_damage = round((global.player_weapon_attack + global.player_attack - global.enemy_defense_stat) * 1)
111
            global.current_hp_enemy -= shot_damage
112
            global.current_hp_enemy_draw = global.current_hp_enemy
113
            audio_play_sound(snd_arc_hit, 0.1, 0)
114
            if (object_index != obj_heart_yellow_shot_blast_collider)
115
                instance_destroy()
116
        }
117
    }
118
}