Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_martlet_package_Step_0

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_heart_battle_fighting_parent))
2
{
3
    instance_destroy()
4
    return;
5
}
6
if (image_alpha < 1 && can_move == false)
7
{
8
    image_alpha += 0.1
9
    if (image_alpha > 1)
10
        image_alpha = 1
11
    if (image_alpha == 1)
12
        can_move = true
13
}
14
if (can_move == true)
15
{
16
    package_vsp += package_grav
17
    x += fly_speed
18
    y += package_vsp
19
    image_angle += angle_sway
20
}
21
if (y > battle_box_bottom)
22
{
23
    if (image_index == 0)
24
    {
25
        image_index = 1
26
        image_angle = 0
27
        mask_index = -4
28
        fly_speed = 0
29
        angle_sway = choose(1, -1)
30
        package_vsp = -4
31
        fade_out = true
32
        var junk_count = irandom_range(3, 4)
33
        var junk_dir = irandom_range(15, (180 / junk_count))
34
        while (junk_count > 0)
35
        {
36
            with (instance_create(x, y, obj_battle_enemy_attack_martlet_package_junk))
37
                junk_direction = 0 + junk_dir * junk_count + junk_dir * junk_count
38
            junk_count -= 1
39
        }
40
        var sound_type = irandom_range(1, 3)
41
        switch sound_type
42
        {
43
            case 1:
44
                audio_play_sound(snd_mart_impact_1, 20, 0)
45
                break
46
            case 2:
47
                audio_play_sound(snd_mart_impact_2, 20, 0)
48
                break
49
            case 3:
50
                audio_play_sound(snd_mart_impact_3, 20, 0)
51
                break
52
            default:
53
                audio_play_sound(snd_mart_impact_2, 20, 0)
54
        }
55
56
    }
57
}
58
if (fade_out == true)
59
{
60
    image_alpha -= 0.1
61
    if (image_alpha < 0)
62
        image_alpha = 0
63
    if (image_alpha == 0)
64
        instance_destroy()
65
}