Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_axis_turret_2_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
var battle_box = obj_dialogue_box_battle_transformation_any
4
if destroy_self
5
{
6
    image_alpha -= 0.2
7
    if (image_alpha <= 0)
8
        instance_destroy()
9
}
10
else if (image_alpha < 1)
11
    image_alpha += 0.2
12
switch scene
13
{
14
    case 0:
15
        image_speed = 1
16
        audio_play_sound(snd_arc_shoot, 1, 0)
17
        var bullet = instance_create_depth((x + (lengthdir_x((speed * 2), direction))), (y + (lengthdir_y((speed * 2), direction))), -100, obj_battle_enemy_attack_axis_turret_bullet)
18
        bullet.direction = image_angle
19
        bullet.image_angle = bullet.direction
20
        bullet.speed = 8
21
        shot_number--
22
        scene++
23
        break
24
    case 1:
25
        if cutscene_wait(0.25)
26
            scene = 0
27
        break
28
}
29
30
var base_speed = 5
31
var variation = choose(1, 2)
32
switch side
33
{
34
    case 1:
35
        if (!dir_noloop)
36
        {
37
            if (variation == 1)
38
                hspeed = base_speed
39
            else
40
                vspeed = base_speed
41
            dir_noloop = true
42
        }
43
        if (x > target_x)
44
            destroy_self = true
45
        break
46
    case 2:
47
        if (!dir_noloop)
48
        {
49
            if (variation == 1)
50
                hspeed = (-base_speed)
51
            else
52
                vspeed = base_speed
53
            dir_noloop = true
54
        }
55
        if (y > target_y)
56
            destroy_self = true
57
        break
58
    case 3:
59
        if (!dir_noloop)
60
        {
61
            if (variation == 1)
62
                hspeed = (-base_speed)
63
            else
64
                vspeed = (-base_speed)
65
            dir_noloop = true
66
        }
67
        break
68
    case 4:
69
        if (!dir_noloop)
70
        {
71
            if (variation == 1)
72
                hspeed = base_speed
73
            else
74
                vspeed = (-base_speed)
75
            dir_noloop = true
76
        }
77
        if (y < target_y)
78
            destroy_self = true
79
        break
80
}
81
82
if ((hspeed > 0 && x > target_x) || (hspeed < 0 && x < target_x) || (vspeed > 0 && y > target_y) || (vspeed < 0 && y < target_y))
83
    destroy_self = true
84
image_angle = point_direction(x, y, battle_box.x, battle_box.y)