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
    direction -= ((angle_difference(direction, 0)) * 0.3)
9
else
10
{
11
    state = 1
12
    image_angle = 0
13
}
14
if (state == 1)
15
{
16
    direction -= ((angle_difference(direction, point_dir)) * 0.15)
17
    if (shoot_timer > 0)
18
    {
19
        if (can_shoot == false)
20
            shoot_timer--
21
    }
22
    else
23
    {
24
        draw_aim_line = true
25
        audio_play_sound(snd_bullet_warning, 1, 0)
26
        can_shoot = true
27
        shoot_timer = shoot_timer_max
28
    }
29
    if (can_shoot == true)
30
    {
31
        if (shoot_delay > 0)
32
            shoot_delay--
33
        else
34
        {
35
            sprite_index = spr_guardener_guy_gun_gun_shoot
36
            var bullet = instance_create_depth((x + 2), (y - 6), (obj_heart_battle_fighting_parent.depth - 1), obj_battle_enemy_attack_guardener_bullet_b)
37
            bullet.image_angle = direction
38
            audio_play_sound(snd_guardener_shoot, 1, 0)
39
            random_y_offset = choose(-10, 10)
40
            direction += (45 + random_y_offset)
41
            draw_aim_line = false
42
            can_shoot = false
43
            shoot_delay = shoot_delay_max
44
            if (shoot_number > 0)
45
                shoot_number -= 1
46
            else
47
                alarm[0] = 15
alarm[0]

instance_destroy(obj_battle_enemy_attack_guardener_attack_12)
48
        }
49
    }
50
}
51
image_alpha = lerp(image_alpha, 1, 0.2)
52
image_angle = direction
53
x = obj_guardener_guy_c_gun.x + 20
54
y = obj_guardener_guy_c_gun.y - 15