Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_ceroba_arc_diamond_Step_0

(view raw script w/o annotations or w/e)
1
var spin_speed_max = 5
2
var spin_speed_inc = 0.15
3
var bullet_shoot_speed = 5
4
if (bullet_fade_delay > 0)
5
    bullet_fade_delay--
6
else if (image_alpha < 1)
7
{
8
    image_alpha += 0.15
9
    if (!alarm[0])
10
        alarm[0] = bullet_spin_time
alarm[0]

if (image_blend != c_red) { audio_play_sound(snd_bullet_warning, 1, 0) image_blend = c_red alarm[0] = 2 } else { image_blend = c_white alarm[1] = 15 audio_play_sound(snd_ceroba_swoosh, 1, 0) }
11
}
12
switch bullet_state
13
{
14
    case 1:
15
        x = 320 + (lengthdir_x(bullet_distance, bullet_dir_current))
16
        y = 320 + (lengthdir_y(bullet_distance, bullet_dir_current))
17
        bullet_dir_current += bullet_spin_speed
18
        if (bullet_spin_speed < spin_speed_max)
19
            bullet_spin_speed += spin_speed_inc
20
        break
21
    case 2:
22
        speed = bullet_shoot_speed
23
        var battle_box = obj_dialogue_box_battle_transformation_any
24
        if point_in_rectangle(x, y, (battle_box.bbox_left + 15), (battle_box.bbox_top + 15), (battle_box.bbox_right - 15), (battle_box.bbox_bottom - 15))
25
            bullet_state = 3
26
        break
27
    case 3:
28
        battle_box = obj_dialogue_box_battle_transformation_any
29
        var next_position_x = x + (lengthdir_x(speed, direction))
30
        var next_position_y = y + (lengthdir_y(speed, direction))
31
        var boundary_left = battle_box.bbox_left + 10
32
        var boundary_top = battle_box.bbox_top + 10
33
        var boundary_right = battle_box.bbox_right - 10
34
        var boundary_bottom = battle_box.bbox_bottom - 10
35
        if (!(point_in_rectangle(next_position_x, next_position_y, boundary_left, boundary_top, boundary_right, boundary_bottom)))
36
        {
37
            if ((next_position_x > boundary_right || next_position_x < boundary_left) && (next_position_y > boundary_bottom || next_position_y < boundary_top))
38
                direction -= 180
39
            else if (next_position_x > boundary_right)
40
            {
41
                if (direction > 180)
42
                    direction -= 90
43
                else
44
                    direction += 90
45
            }
46
            else if (next_position_x < boundary_left)
47
            {
48
                if (direction > 180)
49
                    direction += 90
50
                else
51
                    direction -= 90
52
            }
53
            else if (next_position_y > boundary_bottom)
54
            {
55
                if (direction > 270)
56
                    direction += 90
57
                else
58
                    direction -= 90
59
            }
60
            else if (next_position_y < boundary_top)
61
            {
62
                if (direction > 90)
63
                    direction += 90
64
                else
65
                    direction -= 90
66
            }
67
            direction += irandom_range(-20, 20)
68
            x = xprevious
69
            y = yprevious
70
            audio_play_sound(snd_decibatbouncewave1, 1, 0)
71
        }
72
        break
73
}
74
75
if (place_meeting(x, y, obj_heart_battle_fighting_parent) && obj_heart_battle_fighting_parent.vulnerable)
76
{
77
    if (!instance_exists(obj_battle_enemy_attack_ceroba_white_soul))
78
        instance_create(obj_heart_battle_fighting_parent.x, obj_heart_battle_fighting_parent.y, obj_battle_enemy_attack_ceroba_white_soul)
79
    else
80
        obj_battle_enemy_attack_ceroba_white_soul.alarm[0] = 30
81
}