Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_ceroba_fire_circle_fireball_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 (state < 3)
7
{
8
    attack_target_x = obj_heart_battle_fighting_parent.x
9
    attack_target_y = obj_heart_battle_fighting_parent.y
10
}
11
x = attack_target_x + (lengthdir_x(attack_distance, attack_dir))
12
y = attack_target_y + (lengthdir_y(attack_distance, attack_dir))
13
if (state == 0)
14
{
15
    if (image_alpha < 1 && can_move == false)
16
    {
17
        image_alpha += 0.2
18
        if (image_alpha > 1)
19
            image_alpha = 1
20
    }
21
    if (attack_dir < 360)
22
        attack_dir += bullet_speed
23
    else
24
        attack_dir = bullet_speed
25
}
26
if (state == 1)
27
{
28
    if (attack_dir < 360)
29
        attack_dir += bullet_speed
30
    else
31
        attack_dir = bullet_speed
32
    bullet_speed = lerp(bullet_speed, 0, 0.75)
33
    if (round(bullet_speed) == 0)
34
        state = 2
35
}
36
if (state == 2)
37
{
38
    attack_distance = lerp(attack_distance, attack_distance_max, 0.5)
39
    if (round(attack_distance) == attack_distance_max)
40
    {
41
        state = 3
42
        audio_play_sound(snd_ceroba_swoosh, 1, 0)
43
    }
44
}
45
if (state == 3)
46
{
47
    if (attack_distance > 0)
48
        attack_distance -= homing_speed
49
    else
50
    {
51
        var count = 0
52
        with (object_index)
53
        {
54
            if (bullet_spawner == other.bullet_spawner)
55
                count += 1
56
        }
57
        if (count == 1)
58
            instance_create(attack_target_x, attack_target_y, obj_battle_enemy_attack_ceroba_fire_circle_explosion)
59
        instance_destroy()
60
        instance_destroy(bullet_spawner)
61
    }
62
    homing_speed += 1
63
}