Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_trihecta_circle_reflect_Step_0

(view raw script w/o annotations or w/e)
1
if (image_alpha < 1 && started == false)
2
{
3
    image_alpha += 0.05
4
    if (image_alpha > 1)
5
        image_alpha = 1
6
    if (image_alpha == 1)
7
        started = true
8
}
9
if (started == true)
10
{
11
    ds_list_add(x_list, x)
12
    ds_list_add(y_list, y)
13
    while (ds_list_size(x_list) > max_points_trail)
14
    {
15
        ds_list_delete(x_list, 0)
16
        ds_list_delete(y_list, 0)
17
    }
18
}
19
if (instance_exists(obj_dialogue_box_battle_transformation_any) && started == true)
20
{
21
    var can_move = true
22
    var execute_collision = false
23
    if ((sign(move_x) == -1 && (bbox_left + move_x) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4)) || (sign(move_x) == 1 && (bbox_right + move_x) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4)) || (sign(move_y) == -1 && (bbox_top + move_y) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4)) || (sign(move_y) == 1 && (bbox_bottom + move_y) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4)))
24
    {
25
        var move_x_temp = move_x / move_speed_max
26
        var move_y_temp = move_y / move_speed_max
27
        while ((bbox_left + sign(move_x_temp)) > (obj_dialogue_box_battle_transformation_any.bbox_left + 4) && (bbox_right + sign(move_x_temp)) < (obj_dialogue_box_battle_transformation_any.bbox_right - 4) && (bbox_top + sign(move_y_temp)) > (obj_dialogue_box_battle_transformation_any.bbox_top + 4) && (bbox_bottom + sign(move_y_temp)) < (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
28
        {
29
            x += move_x_temp
30
            y += move_y_temp
31
        }
32
        execute_collision = true
33
    }
34
    if (execute_collision == true)
35
    {
36
        if ((bbox_left + sign(move_x)) <= (obj_dialogue_box_battle_transformation_any.bbox_left + 4) || (bbox_right + sign(move_x)) >= (obj_dialogue_box_battle_transformation_any.bbox_right - 4))
37
            move_x = (-move_x)
38
        if ((bbox_top + sign(move_y)) <= (obj_dialogue_box_battle_transformation_any.bbox_top + 4) || (bbox_bottom + sign(move_y)) >= (obj_dialogue_box_battle_transformation_any.bbox_bottom - 4))
39
            move_y = (-move_y)
40
        var random_pitch = irandom_range(-1, 1)
41
        audio_play_sound(snd_trihecta_reflect_balls, 20, 0)
42
        audio_sound_pitch(snd_trihecta_reflect_balls, (1 + random_pitch * 0.3))
43
        can_move = false
44
    }
45
    if (can_move == true)
46
    {
47
        x += move_x
48
        y += move_y
49
    }
50
}