Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_guardener_guy_gun_gun_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
state = 2;
4
var xx = obj_heart_battle_fighting_parent.x;
5
var yy = obj_heart_battle_fighting_parent.y + 5;
6
var point_dir = point_direction(x, y, xx, yy);
7
if (abs(angle_difference(direction, 0)) > 1 && state == 0)
8
{
9
    direction -= (angle_difference(direction, 0) * 0.3);
10
}
11
else
12
{
13
    state = 1;
14
    image_angle = 0;
15
}
16
if (state == 1)
17
{
18
    direction -= (angle_difference(direction, point_dir) * 0.15);
19
    if (shoot_timer > 0)
20
    {
21
        if (can_shoot == false)
22
            shoot_timer--;
23
    }
24
    else
25
    {
26
        draw_aim_line = true;
27
        audio_play_sound(snd_bullet_warning, 1, 0);
28
        can_shoot = true;
29
        shoot_timer = shoot_timer_max;
30
    }
31
    if (can_shoot == true)
32
    {
33
        if (shoot_delay > 0)
34
        {
35
            shoot_delay--;
36
        }
37
        else
38
        {
39
            sprite_index = spr_guardener_guy_gun_gun_shoot;
40
            var bullet = instance_create_depth(x + 2, y - 6, obj_heart_battle_fighting_parent.depth - 1, obj_battle_enemy_attack_guardener_bullet_b);
41
            bullet.image_angle = direction;
42
            audio_play_sound(snd_guardener_shoot, 1, 0);
43
            random_y_offset = choose(-10, 10);
44
            direction += (45 + random_y_offset);
45
            draw_aim_line = false;
46
            can_shoot = false;
47
            shoot_delay = shoot_delay_max;
48
            if (shoot_number > 0)
49
                shoot_number -= 1;
50
            else
51
                alarm[0] = 15;
gml_Object_obj_guardener_guy_gun_gun_Alarm_0.gml

instance_destroy(obj_battle_enemy_attack_guardener_attack_12);
52
        }
53
    }
54
}
55
image_alpha = lerp(image_alpha, 1, 0.2);
56
image_angle = direction;
57
x = obj_guardener_guy_c_gun.x + 20;
58
y = obj_guardener_guy_c_gun.y - 15;